#!/usr/bin/python

# set precision (sp or dp)
my_kind = 'sp'

block_number = "002"
#test_dim = '1d_deflagration_wave'
#test_dim = '2d_laplace'
#test_dim = '3d_triperiodic'
#test_dim = '3d_channel_biperiodic'
#test_dim = '3d_channel_inlet_outlet'
#test_dim = '3d_inlet_outlet_biperiodic'
test_dim = '3d_deflagration_wave'

#-----------------------------------------------------------------------
#SELECT_TEST_DIM_WEBblock_number = ""
#SELECT_TEST_DIM_WEBtest_dim = 'web'
#-----------------------------------------------------------------------

#---------------------------------------------------------
# 1d example - Deflagration wave
#---------------------------------------------------------
if test_dim == '1d_deflagration_wave':
#       NOTE:
#       Possible flames
#       ----------------------------------
#       nt       L       Da      =>  S_L
#       ----------------------------------
#       512      25.     1800.   => 0.005
#       256      12.     80000.  => 0.026
#       ----------------------------------
	random_ornot = "random_no"
	mpi_periodic = {'1':'no'}
	N_dim = 1 ; 
	N_equ = 5 ; 
	N_add_var = 5 ; 
	i_kutta = 5 #; ng = 3

	add_variables = {
	     'n' : 5,#N_add_var,
	     '1' : {'symbol':'uuu','name':'velocity'} ,
	     '2' : {'symbol':'tem','name':'temperature'} ,
	     '3' : {'symbol':'yya','name':'specie a'} ,
	     '4' : {'symbol':'yyb','name':'specie b'} ,
	     '5' : {'symbol':'wwx','name':'reaction rate'} ,
			}
	sca_variables = {
	     '1' : {'symbol':'pre','name':'initial pressure'} ,
	     '2' : {'symbol':'gam','name':'gas constant'} ,
	     '3' : {'symbol':'dha','name':'enthalpy a'} ,
	     '4' : {'symbol':'dhb','name':'enthalpy b'} ,
	     '5' : {'symbol':'pra','name':'prandtl'} ,
	     '6' : {'symbol':'lew','name':'lewis'} ,
	     '7' : {'symbol':'dam','name':'damkholer'} ,
	     '8' : {'symbol':'zel','name':'zeldovich'} ,
	     '9' : {'symbol':'drh','name':'d(rho) for bc'} ,
	    '10' : {'symbol':'dr1','name':'first riemann wave'} ,
	    '11' : {'symbol':'dth','name':'d(theta) for bc'} ,
	    '12' : {'symbol':'dya','name':'d(ya) for bc'} ,
	    '13' : {'symbol':'dyb','name':'d(yb) for bc'} ,
	    '14' : {'symbol':'csp','name':'sound speed'} ,
	    '15' : {'symbol':'duu','name':'d(u) for bc'} ,
	    '16' : {'symbol':'dee','name':'d(e) for bc'} ,
	    '17' : {'symbol':'xfn','name':'flame front abscissa new'} ,
	    '18' : {'symbol':'xan','name':'achoring flame front abscissa'} ,
	    '19' : {'symbol':'xfo','name':'flame front abscissa old'},
#	    '19' : {'symbol':'xfo','name':'flame front abscissa old','print':'yes'} ,
	    '20' : {'symbol':'vfr','name':'flame front velocity'} ,
	    '21' : {'symbol':'wma','name':'maximum reaction rate'} ,
	    '22' : {'symbol':'aaa','name':'for interpolation '} ,
	    '23' : {'symbol':'bbb','name':'for interpolation'} ,
	    '24' : {'symbol':'ccc','name':'for interpolation'} ,
	    '25' : {'symbol':'xsx','name':'for interpolation'} ,
	    '26' : {'symbol':'xdx','name':'for interpolation'} ,
	    '27' : {'symbol':'wms','name':'for interpolation'} ,
	    '28' : {'symbol':'wmd','name':'for interpolation'} ,
	    '29' : {'symbol':'pp1','name':'for interpolation'} ,
	    '30' : {'symbol':'pp2','name':'for interpolation'} ,
	    '31' : {'symbol':'pp3','name':'for interpolation'} ,
	    '32' : {'symbol':'vbl','name':'v_blow'} ,
	    '33' : {'symbol':'dr2','name':'second riemann wave'} ,
	                       }
	
	space_variables = { 
	     'n' : N_dim,
	     '1' : {'symbol':'x','name':'horizontal coordinate','nt':256,'ng':2,'L':12.,'fun':'x','spacing':'uniform'}
# 2nd flame   '1' : {'symbol':'x','name':'horizontal coordinate','nt':512,'ng':2,'L':25.,'fun':'x','spacing':'uniform'}
	                  }
	variables = { 
	     'n' : N_equ,
	     '1' : {'symbol':'rho','name':'density'     },
	     '2' : {'symbol':'rhu','name':'momentum'    },
	     '3' : {'symbol':'rhe','name':'total energy'},
	     '4' : {'symbol':'rya','name':'specie a'    },
	     '5' : {'symbol':'ryb','name':'specie b'    },
	            }
	initial = { 
	     'n' : N_equ,
	     '1' : 'gam/(gam-1.)*pre/tem',
	     '2' : '0.',
	     '3' : 'rho*(1./gam*(tem-1.)+yya*dha+yyb*dhb+0.5*(rhu/rho)**2)',
	     '4' : 'rho*yya',
	     '5' : 'rho*yyb',
	         }
	equations = {
	     'n' : N_equ,
	     '1' : {'equation':'-#[ddx]{rhu}'},
	     '2' : {'equation':'-0.5*(#[ddx]{rhu*uuu}+uuu*#[ddx]{rhu}+rhu*#[ddx]{uuu})-#[ddx]{(gam-1.)/gam*rho*tem}+#[dsx]{4./3.*pra*uuu}'},
	     #'2' : {'equation':'-#[ddx]{rho*uuu**2+(gam-1.)/gam*rho*tem}+#[dsx]{4./3.*pra*uuu}'},
	     '3' : {'equation':'-0.5*(#[ddx]{rhe*uuu}+rhe/rho*#[ddx]{rhu}+rhu*#[ddx]{rhe/rho})-#[ddx]{(gam-1.)/gam*rho*tem*uuu}+#[dsx]{tem+1./lew*(yya*dha+yyb*dhb)}'},
	     #'3' : {'equation':'-#[ddx]{(rhe+(gam-1.)/gam*rho*tem)*uuu}+#[dsx]{tem+1./lew*(yya*dha+yyb*dhb)}'},
	     '4' : {'equation':'-0.5*(#[ddx]{rya*uuu}+yya*#[ddx]{rhu}+rhu*#[ddx]{yya})+#[dsx]{1./lew*yya}-wwx'},
	     #'4' : {'equation':'-#[ddx]{rya*uuu}+#[dsx]{1./lew*yya}-wwx'},
	     '5' : {'equation':'0.'},
	            }
	ini_preamble = {
             'n' : 2,
	     '1' : {
		       'type' : 'ghost',
		       'n':3,
	               '1': {'lhs':'tem', 'equation':'86.3 + 253.7 * (-atan(-500.)+atan(50.*(g_x-0.4*lx)))'},
	               '2': {'lhs':'yya', 'equation':'0.054861 *(1.-0.5*(2./acos(-1.)*atan(g_x-0.4*lx)+1.))'},
	               '3': {'lhs':'yyb', 'equation':'0.'},
	           },
	     '2' : {
		       'type' : 'scalar',
		       'n':12,
	               '1': {'lhs':'gam', 'equation':'1.32'},
	               '2': {'lhs':'pre', 'equation':'10000.'},
	               '3': {'lhs':'dha', 'equation':'10000.'},
	               '4': {'lhs':'dhb', 'equation':'0.'},
	               '5': {'lhs':'pra', 'equation':'0.74'},
	               '6': {'lhs':'lew', 'equation':'1.'},
	               '7': {'lhs':'dam', 'equation':'80000.'},
	               # 2nd FLAME'7': {'lhs':'dam', 'equation':'1800.'},
	               '8': {'lhs':'zel', 'equation':'1060.'},
	               '9': {'lhs':'xfn', 'equation':'0.4*lx'},
	              '10': {'lhs':'xfo', 'equation':'0.4*lx'},
	              '11': {'lhs':'vfr', 'equation':'0.'},
	              '12': {'lhs':'xan', 'equation':'0.4*lx'},
                   }
                       }
	rhs_preamble = {
             'n' : 1,
	     '1' : {
		       'type' : 'ghost',
		       'n' : 5,
		       '1' : { 'lhs':'uuu', 'equation':'rhu/rho' },
		       '2' : { 'lhs':'tem', 'equation':'gam*((rhe-rya*dha-ryb*dhb)/rho-0.5*uuu**2)+1.'},
		       '3' : { 'lhs':'yya', 'equation':'rya/rho'},
		       '4' : { 'lhs':'yyb', 'equation':'ryb/rho'},
		       '5' : { 'lhs':'wwx', 'equation':'dam*rya*exp(-zel/tem*gam/(gam-1.))'},
	            }
                        }
	post_preamble = {
             'n' : 4,
	     '1' : {
		       'type' : 'scalar',
		       'n':1,
	               '1': {'lhs':'wma', 'equation':'0.'},
                   },
	     '2' : {
		       'type' : 'internal',
		       'n':9,
		       '1' : { 'lhs':'uuu', 'equation':'rhu/rho' },
		       '2' : { 'lhs':'tem', 'equation':'gam*((rhe-rya*dha-ryb*dhb)/rho-0.5*uuu**2)+1.'},
		       '3' : { 'lhs':'wwx', 'equation':'dam*rya*exp(-zel/tem*gam/(gam-1.))'},
		      # '3' : { 'lhs':'wwx', 'equation':'1./(abs(tem-220.))'},
		       '4' : { 'lhs':'if(wwx.gt.wma) xfn', 'equation':'g_x'},
		       '5' : { 'lhs':'if(wwx.gt.wma) xsx', 'equation':'#[edx]{g_x}'},
		       '6' : { 'lhs':'if(wwx.gt.wma) xdx', 'equation':'#[ecx]{g_x}'},
		       '7' : { 'lhs':'if(wwx.gt.wma) wms', 'equation':'#[edx]{wwx}'},
		       '8' : { 'lhs':'if(wwx.gt.wma) wmd', 'equation':'#[ecx]{wwx}'},
		       '9' : { 'lhs':'if(wwx.gt.wma) wma', 'equation':'wwx'},
	           },
	     '3' : {
		       'type' : 'scalar',
		       'n':9,
                       '1': {'lhs':'aaa' ,'equation': '(xsx-xfn)*(xsx-xdx)'},
                       '2': {'lhs':'bbb' ,'equation': '(xfn-xsx)*(xfn-xdx)'},
                       '3': {'lhs':'ccc' ,'equation': '(xdx-xsx)*(xdx-xfn)'},
                       '4': {'lhs':'pp2' ,'equation': 'wms/aaa + wma/bbb + wmd/ccc'},
                       '5': {'lhs':'pp1' ,'equation': '(-xdx*wms-xfn*wms)/aaa+(-xdx*wma-xsx*wma)/bbb+(-xsx*wmd-xfn*wmd)/ccc'},
                       '6': {'lhs':'xfn' ,'equation': '-pp1/(2.*pp2)'},
		       '7' : { 'lhs':'vfr', 'equation':'(xfn-xfo)/dt' },
		       '8' : { 'lhs':'xfo', 'equation':'xfn' },
		       '9' : { 'lhs':'vbl', 'equation':'0.0001*(xan-xfn)-0.0001*vfr' },
                   },
	     '4' : {
		       'type' : 'ghost',
		       'n':2,
		       '1' : { 'lhs':'rhu', 'equation':'rhu+rho*vbl' },
		       '2' : { 'lhs':'rhe', 'equation':'rhe+0.5*rho*(vbl**2+2.*rhu/rho*vbl)' },
                   },
                      }
	boundary = {
	     '1-start'  : {
			    'rhs' : {
			             'n': 1 ,
                                     '1' : {
			                     'type' : 'manual',
			             	     'node' : 'boundary',
                                             'n' : 15,
                                             '1' : {'lhs':'uuu','equation':'rhu/rho'},
                                             '2' : {'lhs':'yya','equation':'rya/rho'},
                                             '3' : {'lhs':'tem','equation':'gam*((rhe-rya*dha)/rho-0.5*(uuu**2)+1.)'},
                                             '4' : {'lhs':'csp','equation':'sqrt((gam-1.)*tem)'},
                                             '5' : {'lhs':'dya','equation':'rhs_rya/rho-rya /rho**2*rhs_rho'},
                                             '6' : {'lhs':'duu','equation':'rhs_rhu/rho-rhu /rho**2*rhs_rho'},
                                             '7' : {'lhs':'dee','equation':'rhs_rhe/rho-rhe /rho**2*rhs_rho'},
                                             '8' : {'lhs':'dth','equation':'gam*(dee-uuu*duu- dha*dya)'},
                                             '9' : {'lhs':'dr1','equation':'duu-(gam-1.)/(gam*csp)*(dth+ tem/rho*rhs_rho)'},
                                             '10' : {'lhs':'duu','equation':'0.'},
                                             '11' : {'lhs':'rhs_rho','equation':'rho*csp/(((gam- 1.)/gam)*tem)*(duu-dr1)'},
                                             '12' : {'lhs':'dee','equation':'uuu*duu'},
                                             '13' : {'lhs':'rhs_rhu','equation':'rho*duu+uuu*rhs_rho'},
                                             '14' : {'lhs':'rhs_rhe','equation':'rhe/rho *rhs_rho+rho*dee'},
                                             '15' : {'lhs':'rhs_rya','equation':'yya*rhs_rho'},
	                                   # '10' : {'lhs':'rhs_rho','equation':'0.'},
	                                   # '11' : {'lhs':'rhs_rhu','equation':'0.'},
	                                   # '12' : {'lhs':'rhs_rhe','equation':'0.'},
	                                   # '13' : {'lhs':'rhs_rya','equation':'0.'},
	                                   # '14' : {'lhs':'rhs_ryb','equation':'0.'},
                                           },
                                    },
			    'var' : {
			             'n': 1 ,
                                     '1' : {
			                    'type' : 'manual',
			             	    'node' : 'ghost',
                                             'n' : 5,
	                                     '1' : {'lhs':'rho','equation':'#[ecx]{rho}'},
	                                     '2' : {'lhs':'rhu','equation':'#[ecx]{rhu}'},
	                                     '3' : {'lhs':'rhe','equation':'#[ecx]{rhe}'},
	                                     '4' : {'lhs':'rya','equation':'#[ecx]{rya}'},
	                                     '5' : {'lhs':'ryb','equation':'#[ecx]{ryb}'},
	                                     #'1' : {'lhs':'tem','equation':'gam*((rhe-rya*dha)/rho-0.5*(rhu/rho)**2)+1.'},
	                                     #'2' : {'lhs':'uuu','equation':'rhu/rho'}, #[ecx]{rhu}'},
	                                     #'3' : {'lhs':'rho','equation':'rho*tem/86.3'},
	                                     #'4' : {'lhs':'rya','equation':'rho*0.054861'},
	                                     #'5' : {'lhs':'ryb','equation':'0.'},
	                                     #'6' : {'lhs':'rhu','equation':'rhu'}, #[ecx]{uuu}*rho'},
	                                     #'7' : {'lhs':'tem','equation':'86.3'},
	                                     #'8' : {'lhs':'rhe','equation':'rho*(1./gam*(tem-1.)+(rya/rho)*dha+0.5*(rhu/rho)**2)'}
                                           },
                                    },
	                  } , 
	     '1-end'    : {
                            'rhs' : {
			             'n': 1 ,
                                     '1' : {
			                     'type' : 'manual',
			             	     'node' : 'boundary',
                                             'n' : 15,
		       			     '1' : {'lhs':'uuu','equation':'rhu/rho' },
		       			     '2' : {'lhs':'tem','equation':'gam*((rhe-rya*dha-ryb*dhb)/rho-0.5*uuu**2)+1.'},
	                                     '3' : {'lhs':'csp','equation':'sqrt((gam-1.)*tem)'},
	                                     '4' : {'lhs':'dya','equation':'rhs_rya/rho-rya/rho**2*rhs_rho'},
	                                     '5' : {'lhs':'dyb','equation':'rhs_ryb/rho-ryb/rho**2*rhs_rho'},
	                                     '6' : {'lhs':'duu','equation':'rhs_rhu/rho-rhu/rho**2*rhs_rho'},
	                                     '7' : {'lhs':'dee','equation':'rhs_rhe/rho-rhe/rho**2*rhs_rho'},
	                                     '8' : {'lhs':'dth','equation':'gam*(dee-uuu*duu-dha*dya-dhb*dyb)'},
	                                     '9' : {'lhs':'dr2','equation':'duu+(gam-1.)/(gam*csp)*(dth+tem/rho*rhs_rho)'},
	                                     '10' : {'lhs':'rhs_rho','equation':'gam*rho*csp*dr2/(2.*tem*(gam-1.))-rho/tem*dth'},
	                                     '11' : {'lhs':'rhs_rhu','equation':'0.5*rho*dr2+uuu*rhs_rho'},
	                                     '12' : {'lhs':'dee','equation':'1./gam*dth+dya*dha+dyb*dhb+uuu*0.5*dr2'},
	                                     '13' : {'lhs':'rhs_rhe','equation':'rhe/rho*rhs_rho+rho*dee'},
	                                     '14' : {'lhs':'rhs_rya','equation':'rya/rho*rhs_rho+rho*dya'},
	                                     '15' : {'lhs':'rhs_ryb','equation':'ryb/rho*rhs_rho+rho*dyb'},
                                           },
                                    },
			    'var' : {
			             'n': 1 ,
                                     '1' : {
			                    'type' : 'manual',

# imposed for detonation
#			                    'node' : 'ghost',
#                                            'n' : 5,
#		                            '1' : { 'lhs':'rhe', 'equation':'33889.50707' },
#		                            '2' : { 'lhs':'rhu', 'equation':'0.' }, #-0.98165747451149332' },
#		                            '3' : { 'lhs':'rya', 'equation':'0.' },
#		                            '4' : { 'lhs':'ryb', 'equation':'0.' },
#		                            '5' : { 'lhs':'rho', 'equation':'49.480252823158779' },

# extrpolation
   			             	     'node' : 'ghost',
                                             'n' : 5,
	                                     '1' : {'lhs':'rho','equation':'#[edx]{rho}'},
	                                     '2' : {'lhs':'rhu','equation':'#[edx]{rhu}'},
	                                     '3' : {'lhs':'rhe','equation':'#[edx]{rhe}'},
	                                     '4' : {'lhs':'rya','equation':'#[edx]{rya}'},
	                                     '5' : {'lhs':'ryb','equation':'#[edx]{ryb}'},

                                           },
                                    },
	                  } , 
                   }
#---------------------------------------------------------
# 2d example - Laplace Equation
#---------------------------------------------------------
if test_dim == '2d_laplace':
	random_ornot = "random_no"
	mpi_periodic = {'1':'no','2':'no'}
	N_dim = 2 ; 
        N_equ = 1 ; 
        N_add_var = 0 ; 
        i_kutta = 5 
	
        add_variables = {
             'n' : N_add_var,
        		}
        sca_variables = {
             '1' : {'symbol':'nuu','name':'conduction factor'} ,
		        }

	compact_operators = {}

	space_variables = { 
	     'n' : N_dim,
	     '1' : {'symbol':'x','name':'x-coordinate','nt':6000,'ng':2,'L':628.30,'fun':'x','spacing':'uniform'},
	     '2' : {'symbol':'y','name':'y-coordinate','nt':6000,'ng':2,'L':628.30,'fun':'y','spacing':'uniform'},
	                  }
	variables = { 
	     'n' : N_equ,
	     '1' : {'symbol':'tem','name':'temperature'},
	            }
	initial = { 
	     'n' : N_equ,
	     '1' : '1.',
	            }
	equations = {
	     'n' : N_equ,
	     '1' : {'equation':'nuu*(#[dsx]{tem}+#[dsy]{tem})'},
	            }
	ini_preamble = {
             'n' : 1,
	     '1' :         {
		               'type' : 'scalar',
		               'n':1,
	                       '1': {'lhs':'nuu', 'equation':'0.001'},
	                   },
                       }
	rhs_preamble = {
             'n' : 0,
                       }
	post_preamble = {
	     'n' : 0,
                        }
	boundary = {
	     '1-start'  : {
			    'rhs' : {
			             'n': 0 ,
                                    },
			    'var' : {
			             'n': 1 ,
                                     '1' : {
			                    'type' : 'manual',
			             	    'node' : 'ghost',
                                            'n' : 1,
	                                    '1' : {'lhs':'tem','equation':'0.'},
                                           },
                                    },
	                  } , 
	     '1-end'    : {
                            'rhs' : {
                                      'n':0
                                    },
			    'var' : {
			             'n': 1 ,
                                     '1' : {
			                    'type' : 'manual',
			             	    'node' : 'ghost_and_boundary',
                                            'n' : 1,
	                                    '1' : {'lhs':'tem','equation':'0.'},
                                           },
                                    },
	                  } , 
	     '2-start'  : {
			    'rhs' : {
			             'n': 0 ,
                                    },
			    'var' : {
			             'n': 1 ,
                                     '1' : {
			                     'type' : 'manual',
			             	     'node' : 'ghost_and_boundary',
                                             'n' : 1,
	                                     '1' : {'lhs':'tem','equation':'1.'},
                                           },
                                    },
	                  } , 
	     '2-end'    : {
                            'rhs' : {
                                      'n':0
                                    },
			    'var' : {
			             'n': 1 ,
                                     '1' : {
			                     'type' : 'manual',
			             	     'node' : 'ghost_and_boundary',
                                             'n' : 1,
	                                     '1' : {'lhs':'tem','equation':'0.'},
                                           },
                                    },
	                  } , 
                   }
#---------------------------------------------------------
# 3d example: inlet-outlet bi-periodic, requires multi-block CUBE-Flu for Inlet B.C.!
#---------------------------------------------------------
if test_dim == '3d_inlet_outlet_biperiodic':
	random_ornot = "random_no"
	mpi_periodic = {'1':'no','2':'yes','3':'yes'}
	N_dim = 3 ; 
        N_equ = 5 ; 
        N_add_var = 13 ; 
        i_kutta = 5 
	
        add_variables = {
             'n' : N_add_var,
             '1' : {'symbol':'uuu','name':'u-vel'} ,
             '2' : {'symbol':'vvv','name':'v-vel'} ,
             '3' : {'symbol':'www','name':'w-vel'} ,
             '4' : {'symbol':'tem','name':'temperature'} ,
             '5' : {'symbol':'hhh','name':'enthalpy'} ,
             '6' : {'symbol':'pre','name':'pressure'} ,
             '7' : {'symbol':'div','name':'divergence of u'} ,
             '8' : {'symbol':'sxx','name':'viscous stress'} ,
             '9' : {'symbol':'syy','name':'viscous stress'} ,
            '10' : {'symbol':'szz','name':'viscous stress'} ,
            '11' : {'symbol':'sxy','name':'viscous stress'} ,
            '12' : {'symbol':'sxz','name':'viscous stress'} ,
            '13' : {'symbol':'syz','name':'viscous stress'} ,
          #  '14' : {'symbol':'det','name':'deta/dy'} ,
          #  '15' : {'symbol':'deq','name':'(deta/dy)**2'} ,
          #  '16' : {'symbol':'ded','name':'d2eta/dy2'} ,
        		}
        sca_variables = {
             '1' : {'symbol':'cvr','name':'initial pressure'} ,
             '2' : {'symbol':'muu','name':'viscosity'} ,
             '3' : {'symbol':'rrr','name':'gas constant'} ,
             '4' : {'symbol':'thz','name':'temperature inf'} ,
             '5' : {'symbol':'kkk','name':'conductivity'} ,
             '6' : {'symbol':'eee','name':'energy'} ,
             '7' : {'symbol':'dpx','name':'zero pressure gradient'} ,
             '8' : {'symbol':'gam','name':'gas constant ratio'} ,
             '9' : {'symbol':'the','name':'temperature scalar'} ,
             '10' : {'symbol':'pig','name':'pi greco!'} ,
             '11' : {'symbol':'csp','name':'sound speed'} ,
             '12' : {'symbol':'duu','name':'d(u) for bc'} ,
             '13' : {'symbol':'dee','name':'d(e) for bc'} ,
             '14' : {'symbol':'dr1','name':'first riemann wave'} ,
             '15' : {'symbol':'dth','name':'d(theta) for bc'} ,
             '16' : {'symbol':'dvv','name':'d(theta) for bc'} ,
             '17' : {'symbol':'dww','name':'d(theta) for bc'} ,
             '18' : {'symbol':'dpi','name':'for stabilizing flow'} ,
             '19' : {'symbol':'dpl','name':'for stabilizing flow'} ,
             '20' : {'symbol':'pit','name':'for stabilizing flow'} ,
             '21' : {'symbol':'dex','name':'for stabilizing flow'} ,
             '22' : {'symbol':'dey','name':'for stabilizing flow'} ,
             '23' : {'symbol':'dez','name':'for stabilizing flow'} ,
             '24' : {'symbol':'uin','name':'average inlet velocity'} ,
		        }

	compact_operators = {}

	space_variables = { 
	     'n' : N_dim,
	     '1' : {'symbol':'x','name':'streamwise coordinate','nt':8192, 'ng':2,'L':25.1,'fun':'x','spacing':'uniform'},
	     '2' : {'symbol':'y','name':'spanwise coordinate 1','nt':2048,  'ng':2,'L':6.28,'fun':'y','spacing':'uniform'},
	     '3' : {'symbol':'z','name':'spanwise coordinate 2','nt':2048,  'ng':2,'L':6.28,'fun':'z','spacing':'uniform'}
	                  }
	variables = { 
	     'n' : N_equ,
	     '1' : {'symbol':'rho','name':'density'},
	     '2' : {'symbol':'rhu','name':'x-momentum'},
	     '3' : {'symbol':'rhv','name':'y-momentum'},
	     '4' : {'symbol':'rhw','name':'z-momentum'},
	     '5' : {'symbol':'rhe','name':'total energy'},
	            }
	initial = { 
	     'n' : N_equ,
	     '1' : '1.',
	     '2' : 'rho*uin',
	     '3' : '0.',
	     '4' : '0.',
	     '5' : 'rho*(cvr*(tem-thz)+0.5*(rhu/rho)**2+0.5*(rhv/rho)**2+0.5*(rhw/rho)**2)',
	            }
	equations = {
	     'n' : N_equ,
	     '1' : {'equation':'-#[ddx]{rhu}-#[ddy]{rhv}-#[ddz]{rhw}'},
	     '2' : {'equation':'-0.5*(#[ddx]{rhu*uuu}+uuu*#[ddx]{rhu}+rhu*#[ddx]{uuu})-0.5*(#[ddy]{rhv*uuu}+uuu*#[ddy]{rhv}+rhv*#[ddy]{uuu})-0.5*(#[ddz]{rhw*uuu}+uuu*#[ddz]{rhw}+rhw*#[ddz]{uuu})-#[ddx]{pre}+muu*(#[dsx]{uuu}+#[dsy]{uuu}+#[dsz]{uuu})+muu/3.*#[ddx]{div}'},
	     '3' : {'equation':'-0.5*(#[ddx]{rhu*vvv}+vvv*#[ddx]{rhu}+rhu*#[ddx]{vvv})-0.5*(#[ddy]{rhv*vvv}+vvv*#[ddy]{rhv}+rhv*#[ddy]{vvv})-0.5*(#[ddz]{rhw*vvv}+vvv*#[ddz]{rhw}+rhw*#[ddz]{vvv})-#[ddy]{pre}+muu*(#[dsx]{vvv}+#[dsy]{vvv}+#[dsz]{vvv})+muu/3*#[ddy]{div}'},
	     '4' : {'equation':'-0.5*(#[ddx]{rhu*www}+www*#[ddx]{rhu}+rhu*#[ddx]{www})-0.5*(#[ddy]{rhv*www}+www*#[ddy]{rhv}+rhv*#[ddy]{www})-0.5*(#[ddz]{rhw*www}+www*#[ddz]{rhw}+rhw*#[ddz]{www})-#[ddz]{pre}+muu*(#[dsx]{www}+#[dsy]{www}+#[dsz]{www})+muu/3.*#[ddz]{div}'},
	     '5' : {'equation':'-0.5*(#[ddx]{rhu*hhh}+hhh*#[ddx]{rhu}+rhu*#[ddx]{hhh})-0.5*(#[ddy]{rhv*hhh}+hhh*#[ddy]{rhv}+rhv*#[ddy]{hhh})-0.5*(#[ddz]{rhw*hhh}+hhh*#[ddz]{rhw}+rhw*#[ddz]{hhh})+kkk*(#[dsx]{tem}+#[dsy]{tem}+#[dsz]{tem})+#[ddx]{sxx*uuu+sxy*vvv+sxz*www}+#[ddy]{sxy*uuu+syy*vvv+syz*www}+#[ddz]{sxz*uuu+syz*vvv+szz*www}'},
	            }
	ini_preamble = {
             'n' : 2,
	     '1' :         {
		               'type' : 'scalar',
		               'n':10,
	                       '1': {'lhs':'gam', 'equation':'1.4'},
	                       '2': {'lhs':'cvr', 'equation':'716.'},
	                       '3': {'lhs':'muu', 'equation':'0.00005'},
	                       '4': {'lhs':'rrr', 'equation':'287.'},
	                       '5': {'lhs':'thz', 'equation':'1.'},
	                       '6': {'lhs':'kkk', 'equation':'1388.*muu'},
	                       '7': {'lhs':'dpx', 'equation':'-2.*muu'},
	                       '8': {'lhs':'the', 'equation':'0.06'},
	                       '9': {'lhs':'pig', 'equation':'acos(-1.)'},
	                      '10': {'lhs':'uin', 'equation':'1.'},
	                   },
	     '2' :         {
		               'type' : 'ghost',
		               'n':4,
	                       '1': {'lhs':'tem', 'equation':'the'},
	                       '2': {'lhs':'uuu', 'equation':'uin'},
	                       '3': {'lhs':'vvv', 'equation':'0.'},
	                       '4': {'lhs':'www', 'equation':'0.'},
	                       #'2': {'lhs':'uuu', 'equation':'0.1*sin(2*pig/ly*g_y)*cos(2.*pig/lx*g_x)*sin(2*pig/lz*g_z)'},
	                       #'3': {'lhs':'vvv', 'equation':'0.1*cos(2*pig/ly*g_y)*sin(2.*pig/lx*g_x)*sin(2*pig/lz*g_z)'},
	                       #'4': {'lhs':'www', 'equation':'0.1*sin(2*pig/lx*g_x)*sin(2.*pig/ly*g_y)*cos(2*pig/lz*g_z)'},
	                       #'2': {'lhs':'uuu', 'equation':'0.1*2*acos(-1.)*sin(acos(-1.)*(g_y-1.))*cos(g_x)*sin(g_z)'},
	                       #'3': {'lhs':'vvv', 'equation':'-0.1*(1.+cos(acos(-1.)*(g_y-1)))*sin(g_x)*sin(g_z)'},
	                       #'4': {'lhs':'www', 'equation':'0.1*acos(-1.)*sin(g_x)*sin(acos(-1.)*(g_y-1.))*cos(g_z)'},
	                       # '2': {'lhs':'uuu', 'equation':'0.2*(RANDOM-.5)'},
	                       # '3': {'lhs':'vvv', 'equation':'0.2*(RANDOM-.5)'},
	                       # '4': {'lhs':'www', 'equation':'0.2*(RANDOM-.5)'},
	                   },
	  #NON UNIFORM GRID   '3' :         {
	  #NON UNIFORM GRID                     'type' : 'internal',
	  #NON UNIFORM GRID                     'n':3,
	  #NON UNIFORM GRID                     '1': {'lhs':'det', 'equation':'1./#[ddy]{g_y}'},
	  #NON UNIFORM GRID                     '2': {'lhs':'deq', 'equation':'det*det'},
	  #NON UNIFORM GRID                     '3': {'lhs':'ded', 'equation':'-#[dsy]{g_y}*det*det*det'},
          #NON UNIFORM GRID                 }
                       }
	rhs_preamble = {
             'n' : 9,
	     '1' : {
		       'type' : 'ghost',
		       'n':7,
	               '1': {'lhs':'uuu', 'equation':'rhu/rho'},
	               '2': {'lhs':'vvv', 'equation':'rhv/rho'},
	               '3': {'lhs':'www', 'equation':'rhw/rho'},
	               '4': {'lhs':'eee', 'equation':'rhe/rho'},
	               '5': {'lhs':'tem', 'equation':'1./cvr*(eee-0.5*(uuu*uuu+vvv*vvv+www*www))+thz'},
	               '6': {'lhs':'hhh', 'equation':'eee+tem*rrr'},
	               '7': {'lhs':'pre', 'equation':'rho*rrr*tem'},
                   },
	     '2' : {
		       'type' : 'internal',
		       'n':7,
	               '1': {'lhs':'div', 'equation':'#[ddx]{uuu}+#[ddy]{vvv}+#[ddz]{www}'},
	               '2': {'lhs':'sxx', 'equation':'2.*muu*#[ddx]{uuu}-2./3.*muu*div'},
	               '3': {'lhs':'syy', 'equation':'2.*muu*#[ddy]{vvv}-2./3.*muu*div'},
	               '4': {'lhs':'szz', 'equation':'2.*muu*#[ddz]{www}-2./3.*muu*div'},
	               '5': {'lhs':'sxy', 'equation':'muu*(#[ddy]{uuu}+#[ddx]{vvv})'},
	               '6': {'lhs':'sxz', 'equation':'muu*(#[ddz]{uuu}+#[ddx]{www})'},
	               '7': {'lhs':'syz', 'equation':'muu*(#[ddz]{vvv}+#[ddy]{www})'},
                   },
	     '3' : {
		       'type' : 'update',
	               'var'  : 'div',
                   },
	     '4' : {
		       'type' : 'update',
	               'var'  : 'sxx',
                   },
	     '5' : {
		       'type' : 'update',
	               'var'  : 'syy',
                   },
	     '6' : {
		       'type' : 'update',
	               'var'  : 'szz',
                   },
	     '7' : {
		       'type' : 'update',
	               'var'  : 'sxy',
                   },
	     '8' : {
		       'type' : 'update',
	               'var'  : 'sxz',
                   },
	     '9' : {
		       'type' : 'update',
	               'var'  : 'syz',
                   },
                       }
	post_preamble = {
	     'n' : 0,
                        }
	boundary = {
	     '1-start'  : {
			    'rhs' : {
			             'n': 0 ,
                                    },
			    'var' : {
			             'n': 1 ,
                                     '1' : {
			                     'type' : 'manual',
			             	     'node' : 'ghost',
                                             'n' : 5,
	                                     '1' : {'lhs':'rho','equation':'EXC_VAR_1'},
	                                     '2' : {'lhs':'rhu','equation':'EXC_VAR_2+EXC_VAR_1*uin'},
	                                     '3' : {'lhs':'rhv','equation':'EXC_VAR_3'},
	                                     '4' : {'lhs':'rhw','equation':'EXC_VAR_4'},
	                                     '5' : {'lhs':'rhe','equation':'EXC_VAR_5+0.5*(rho*uin**2+2.*rhu*uin)'},
                                           }
                                    },
	                  } , 
	     '1-end'    : {
			    'rhs' : {
			             'n': 1 ,
                                     '1' : {
			                     'type' : 'manual',
			             	     'node' : 'boundary',
                                             'n' : 19,
		       			     '1' : {'lhs':'uuu','equation':'rhu/rho' },
		       			     '2' : {'lhs':'vvv','equation':'rhv/rho' },
		       			     '3' : {'lhs':'www','equation':'rhw/rho' },
		       			     '4' : {'lhs':'eee','equation':'rhe/rho' },
		       			     '5' : {'lhs':'tem','equation':'1./cvr*(eee-0.5*(uuu**2+vvv**2+www**2))+thz'},
	                                     '6' : {'lhs':'csp','equation':'sqrt(gam*rrr*tem)'},
	                                     '7' : {'lhs':'duu','equation':'(rhs_rhu-uuu*rhs_rho)/rho'},
	                                     '8' : {'lhs':'dvv','equation':'(rhs_rhv-vvv*rhs_rho)/rho'},
	                                     '9' : {'lhs':'dww','equation':'(rhs_rhw-www*rhs_rho)/rho'},
	                                     '10' : {'lhs':'dee','equation':'(rhs_rhe-eee*rhs_rho)/rho'},
	                                     '11' : {'lhs':'dth','equation':'1./cvr*(dee-uuu*duu-vvv*dvv-www*dww)'},
	                                     '12' : {'lhs':'dr1','equation':'duu+rrr/(rho*csp)*(rho*dth+tem*rhs_rho)'},
	                                     '13' : {'lhs':'duu','equation':'dr1*0.5'},
	                                     '14' : {'lhs':'rhs_rho','equation':'(rho*csp/rrr*duu-rho*dth)/tem'},
	                                     '15' : {'lhs':'rhs_rhu','equation':'uuu*rhs_rho+rho*duu'},
	                                     '16' : {'lhs':'rhs_rhv','equation':'vvv*rhs_rho+rho*dvv'},
	                                     '17' : {'lhs':'rhs_rhw','equation':'www*rhs_rho+rho*dww'},
	                                     '18' : {'lhs':'dee','equation':'cvr*dth+(uuu*duu+vvv*dvv+www*dww)'},
	                                     '19' : {'lhs':'rhs_rhe','equation':'eee*rhs_rho+rho*dee'},
                                           },
                                    },
			    'var' : {
			             'n': 1 ,
                                     '1' : {
			                     'type' : 'manual',
			             	     'node' : 'ghost',
                                             'n' : 5,
	                                     '1' : {'lhs':'rho','equation':'#[edx]{rho}'},
	                                     '2' : {'lhs':'rhe','equation':'#[edx]{rhe}'},
	                                     '3' : {'lhs':'rhu','equation':'#[edx]{rhu}'},
	                                     '4' : {'lhs':'rhv','equation':'#[edx]{rhv}'},
	                                     '5' : {'lhs':'rhw','equation':'#[edx]{rhw}'},
                                           },
                                    },
	                  } , 
	     '2-start'  : {
			    'rhs' : {
			             'n': 0 ,
                                    },
			    'var' : {
			             'n': 1 ,
                                     '1' : {
			                    'type' : 'manual',
			             	    'node' : 'ghost',
                                            'n' : 5,
	                                    '1' : {'lhs':'rho','equation':'#[ply]{rho}'},
	                                    '2' : {'lhs':'rhu','equation':'#[ply]{rhu}'},
	                                    '3' : {'lhs':'rhv','equation':'#[ply]{rhv}'},
	                                    '4' : {'lhs':'rhw','equation':'#[ply]{rhw}'},
	                                    '5' : {'lhs':'rhe','equation':'#[ply]{rhe}'},
                                           },
                                    },
	                  } , 
	     '2-end'    : {
                            'rhs' : {
                                      'n':0
                                    },
			    'var' : {
			             'n': 1 ,
                                     '1' : {
			                    'type' : 'manual',
			             	    'node' : 'ghost',
                                            'n' : 5,
	                                    '1' : {'lhs':'rho','equation':'#[pry]{rho}'},
	                                    '2' : {'lhs':'rhu','equation':'#[pry]{rhu}'},
	                                    '3' : {'lhs':'rhv','equation':'#[pry]{rhv}'},
	                                    '4' : {'lhs':'rhw','equation':'#[pry]{rhw}'},
	                                    '5' : {'lhs':'rhe','equation':'#[pry]{rhe}'},
                                           },
                                    },
	                  } , 
	     '3-start'  : {
			    'rhs' : {
			             'n': 0 ,
                                    },
			    'var' : {
			             'n': 1 ,
                                     '1' : {
			                    'type' : 'manual',
			             	    'node' : 'ghost',
                                            'n' : 5,
	                                    '1' : {'lhs':'rho','equation':'#[plz]{rho}'},
	                                    '2' : {'lhs':'rhu','equation':'#[plz]{rhu}'},
	                                    '3' : {'lhs':'rhv','equation':'#[plz]{rhv}'},
	                                    '4' : {'lhs':'rhw','equation':'#[plz]{rhw}'},
	                                    '5' : {'lhs':'rhe','equation':'#[plz]{rhe}'},
                                           },
                                    },
	                  } , 
	     '3-end'    : {
                            'rhs' : {
                                      'n':0
                                    },
			    'var' : {
			             'n': 1 ,
                                     '1' : {
			                    'type' : 'manual',
			             	    'node' : 'ghost',
                                            'n' : 5,
	                                    '1' : {'lhs':'rho','equation':'#[prz]{rho}'},
	                                    '2' : {'lhs':'rhu','equation':'#[prz]{rhu}'},
	                                    '3' : {'lhs':'rhv','equation':'#[prz]{rhv}'},
	                                    '4' : {'lhs':'rhw','equation':'#[prz]{rhw}'},
	                                    '5' : {'lhs':'rhe','equation':'#[prz]{rhe}'},
                                           },
                                    },
	                  } , 
                   }
	exchange_data = { 
	     'space_var'        : 'x',
	     'point_index_send' : 25,
	     'var_send'         : 'no',
	     'rhs_send'         : 'no',
	     'n_var_recv'       : 5,
	     'n_rhs_recv'       : 0
	                  }
#---------------------------------------------------------
# 3d example: inlet-outlet channel
#---------------------------------------------------------
if test_dim == '3d_channel_inlet_outlet':
	random_ornot = "random_yes"
	mpi_periodic = {'1':'no','2':'no','3':'yes'}
	N_dim = 3 ; 
        N_equ = 5 ; 
        N_add_var = 16 ; 
        i_kutta = 5 
	
        add_variables = {
             'n' : N_add_var,
             '1' : {'symbol':'uuu','name':'u-vel'} ,
             '2' : {'symbol':'vvv','name':'v-vel'} ,
             '3' : {'symbol':'www','name':'w-vel'} ,
             '4' : {'symbol':'tem','name':'temperature'} ,
             '5' : {'symbol':'hhh','name':'enthalpy'} ,
             '6' : {'symbol':'pre','name':'pressure'} ,
             '7' : {'symbol':'det','name':'deta/dy'} ,
             '8' : {'symbol':'deq','name':'(deta/dy)**2'} ,
             '9' : {'symbol':'ded','name':'d2eta/dy2'} ,
            '10' : {'symbol':'div','name':'divergence of u'} ,
            '11' : {'symbol':'sxx','name':'viscous stress'} ,
            '12' : {'symbol':'syy','name':'viscous stress'} ,
            '13' : {'symbol':'szz','name':'viscous stress'} ,
            '14' : {'symbol':'sxy','name':'viscous stress'} ,
            '15' : {'symbol':'sxz','name':'viscous stress'} ,
            '16' : {'symbol':'syz','name':'viscous stress'} ,
        		}
        sca_variables = {
             '1' : {'symbol':'cvr','name':'initial pressure'} ,
             '2' : {'symbol':'muu','name':'viscosity'} ,
             '3' : {'symbol':'rrr','name':'gas constant'} ,
             '4' : {'symbol':'thz','name':'temperature inf'} ,
             '5' : {'symbol':'kkk','name':'conductivity'} ,
             '6' : {'symbol':'eee','name':'energy'} ,
             '7' : {'symbol':'dpx','name':'zero pressure gradient'} ,
             '8' : {'symbol':'gam','name':'gas constant ratio'} ,
             '9' : {'symbol':'the','name':'temperature scalar'} ,
             '10' : {'symbol':'pig','name':'pi greco!'} ,
             '11' : {'symbol':'csp','name':'sound speed'} ,
             '12' : {'symbol':'duu','name':'d(u) for bc'} ,
             '13' : {'symbol':'dee','name':'d(e) for bc'} ,
             '14' : {'symbol':'dr1','name':'first riemann wave'} ,
             '15' : {'symbol':'dth','name':'d(theta) for bc'} ,
             '16' : {'symbol':'dvv','name':'d(theta) for bc'} ,
             '17' : {'symbol':'dww','name':'d(theta) for bc'} ,
		        }

	compact_operators = {}

	space_variables = { 
	     'n' : N_dim,
	     '1' : {'symbol':'x','name':'streamwise coordinate','nt':256, 'ng':3,'L':6.283185308,'fun':'x','spacing':'uniform'},
	     '2' : {'symbol':'y','name':'wall coordinate',      'nt':128, 'ng':3,'L':1.,         'fun':'math.tanh(4.*(y-0.5))/math.tanh(4./2.)','spacing':'non-uniform'},
	     '3' : {'symbol':'z','name':'spanwise coordinate',  'nt':128, 'ng':3,'L':3.141592653,'fun':'z','spacing':'uniform'}
	                  }
	variables = { 
	     'n' : N_equ,
	     '1' : {'symbol':'rho','name':'density'},
	     '2' : {'symbol':'rhu','name':'x-momentum'},
	     '3' : {'symbol':'rhv','name':'y-momentum'},
	     '4' : {'symbol':'rhw','name':'z-momentum'},
	     '5' : {'symbol':'rhe','name':'total energy'},
	            }
	initial = { 
	     'n' : N_equ,
	     '1' : '1.',
	     '2' : 'rho*(1-g_y**2+uuu)',
	     '3' : 'rho*vvv',
	     '4' : 'rho*www',
	     '5' : 'rho*(cvr*(tem-thz)+0.5*(rhu/rho)**2+0.5*(rhv/rho)**2+0.5*(rhw/rho)**2)',
	            }
	equations = {
	     'n' : N_equ,
	     '1' : {'equation':'-#[ddx]{rhu}-det*#[ddy]{rhv}-#[ddz]{rhw}'},
	     '2' : {'equation':'-0.5*(#[ddx]{rhu*uuu}+uuu*#[ddx]{rhu}+rhu*#[ddx]{uuu})-0.5*det*(#[ddy]{rhv*uuu}+uuu*#[ddy]{rhv}+rhv*#[ddy]{uuu})-0.5*(#[ddz]{rhw*uuu}+uuu*#[ddz]{rhw}+rhw*#[ddz]{uuu})-#[ddx]{pre}+muu*(#[dsx]{uuu}+deq*#[dsy]{uuu}+ded*#[ddy]{uuu}+#[dsz]{uuu})+muu/3.*#[ddx]{div}'},
	     '3' : {'equation':'-0.5*(#[ddx]{rhu*vvv}+vvv*#[ddx]{rhu}+rhu*#[ddx]{vvv})-0.5*det*(#[ddy]{rhv*vvv}+vvv*#[ddy]{rhv}+rhv*#[ddy]{vvv})-0.5*(#[ddz]{rhw*vvv}+vvv*#[ddz]{rhw}+rhw*#[ddz]{vvv})-det*#[ddy]{pre}+muu*(#[dsx]{vvv}+deq*#[dsy]{vvv}+ded*#[ddy]{vvv}+#[dsz]{vvv})+muu/3*det*#[ddy]{div}'},
	     '4' : {'equation':'-0.5*(#[ddx]{rhu*www}+www*#[ddx]{rhu}+rhu*#[ddx]{www})-0.5*det*(#[ddy]{rhv*www}+www*#[ddy]{rhv}+rhv*#[ddy]{www})-0.5*(#[ddz]{rhw*www}+www*#[ddz]{rhw}+rhw*#[ddz]{www})-#[ddz]{pre}+muu*(#[dsx]{www}+deq*#[dsy]{www}+ded*#[ddy]{www}+#[dsz]{www})+muu/3.*#[ddz]{div}'},
	     '5' : {'equation':'-dpx*uuu-0.5*(#[ddx]{rhu*hhh}+hhh*#[ddx]{rhu}+rhu*#[ddx]{hhh})-0.5*det*(#[ddy]{rhv*hhh}+hhh*#[ddy]{rhv}+rhv*#[ddy]{hhh})-0.5*(#[ddz]{rhw*hhh}+hhh*#[ddz]{rhw}+rhw*#[ddz]{hhh})+kkk*(#[dsx]{tem}+deq*#[dsy]{tem}+ded*#[ddy]{tem}+#[dsz]{tem})+#[ddx]{sxx*uuu+sxy*vvv+sxz*www}+det*#[ddy]{sxy*uuu+syy*vvv+syz*www}+#[ddz]{sxz*uuu+syz*vvv+szz*www}'},
	            }
	ini_preamble = {
             'n' : 3,
	     '1' :         {
		               'type' : 'scalar',
		               'n':9,
	                       '1': {'lhs':'gam', 'equation':'1.4'},
	                       '2': {'lhs':'cvr', 'equation':'716.'},
	                       '3': {'lhs':'muu', 'equation':'0.0002304'},
	                       '4': {'lhs':'rrr', 'equation':'287.'},
	                       '5': {'lhs':'thz', 'equation':'1.'},
	                       '6': {'lhs':'kkk', 'equation':'1388.*muu'},
	                       '7': {'lhs':'dpx', 'equation':'-2.*muu'},
	                       '8': {'lhs':'the', 'equation':'0.06'},
	                       '9': {'lhs':'pig', 'equation':'acos(-1.)'},
	                   },
	     '2' :         {
		               'type' : 'ghost',
		               'n':4,
	                       '1': {'lhs':'tem', 'equation':'the'},
	                       '2': {'lhs':'uuu', 'equation':'0.'},
	                       '3': {'lhs':'vvv', 'equation':'0.'},
	                       '4': {'lhs':'www', 'equation':'0.'},
	                       #'2': {'lhs':'uuu', 'equation':'0.1*sin(2*pig/ly*g_y)*cos(2.*pig/lx*g_x)*sin(2*pig/lz*g_z)'},
	                       #'3': {'lhs':'vvv', 'equation':'0.1*cos(2*pig/ly*g_y)*sin(2.*pig/lx*g_x)*sin(2*pig/lz*g_z)'},
	                       #'4': {'lhs':'www', 'equation':'0.1*sin(2*pig/lx*g_x)*sin(2.*pig/ly*g_y)*cos(2*pig/lz*g_z)'},
	                       #'2': {'lhs':'uuu', 'equation':'0.1*2*acos(-1.)*sin(acos(-1.)*(g_y-1.))*cos(g_x)*sin(g_z)'},
	                       #'3': {'lhs':'vvv', 'equation':'-0.1*(1.+cos(acos(-1.)*(g_y-1)))*sin(g_x)*sin(g_z)'},
	                       #'4': {'lhs':'www', 'equation':'0.1*acos(-1.)*sin(g_x)*sin(acos(-1.)*(g_y-1.))*cos(g_z)'},
	                       # '2': {'lhs':'uuu', 'equation':'0.2*(RANDOM-.5)'},
	                       # '3': {'lhs':'vvv', 'equation':'0.2*(RANDOM-.5)'},
	                       # '4': {'lhs':'www', 'equation':'0.2*(RANDOM-.5)'},
	                   },
	     '3' :         {
		               'type' : 'internal',
		               'n':3,
	                       '1': {'lhs':'det', 'equation':'1./#[ddy]{g_y}'},
	                       '2': {'lhs':'deq', 'equation':'det*det'},
	                       '3': {'lhs':'ded', 'equation':'-#[dsy]{g_y}*det*det*det'},
                           }
                       }
	rhs_preamble = {
             'n' : 9,
	     '1' : {
		       'type' : 'ghost',
		       'n':7,
	               '1': {'lhs':'uuu', 'equation':'rhu/rho'},
	               '2': {'lhs':'vvv', 'equation':'rhv/rho'},
	               '3': {'lhs':'www', 'equation':'rhw/rho'},
	               '4': {'lhs':'eee', 'equation':'rhe/rho'},
	               '5': {'lhs':'tem', 'equation':'1./cvr*(eee-0.5*(uuu*uuu+vvv*vvv+www*www))+thz'},
	               '6': {'lhs':'hhh', 'equation':'eee+tem*rrr'},
	               '7': {'lhs':'pre', 'equation':'rho*rrr*tem'},
                   },
	     '2' : {
		       'type' : 'internal',
		       'n':7,
	               '1': {'lhs':'div', 'equation':'#[ddx]{uuu}+det*#[ddy]{vvv}+#[ddz]{www}'},
	               '2': {'lhs':'sxx', 'equation':'2.*muu*#[ddx]{uuu}-2./3.*muu*div'},
	               '3': {'lhs':'syy', 'equation':'2.*muu*det*#[ddy]{vvv}-2./3.*muu*div'},
	               '4': {'lhs':'szz', 'equation':'2.*muu*#[ddz]{www}-2./3.*muu*div'},
	               '5': {'lhs':'sxy', 'equation':'muu*(det*#[ddy]{uuu}+#[ddx]{vvv})'},
	               '6': {'lhs':'sxz', 'equation':'muu*(#[ddz]{uuu}+#[ddx]{www})'},
	               '7': {'lhs':'syz', 'equation':'muu*(#[ddz]{vvv}+det*#[ddy]{www})'},
                   },
	     '3' : {
		       'type' : 'update',
	               'var'  : 'div',
                   },
	     '4' : {
		       'type' : 'update',
	               'var'  : 'sxx',
                   },
	     '5' : {
		       'type' : 'update',
	               'var'  : 'syy',
                   },
	     '6' : {
		       'type' : 'update',
	               'var'  : 'szz',
                   },
	     '7' : {
		       'type' : 'update',
	               'var'  : 'sxy',
                   },
	     '8' : {
		       'type' : 'update',
	               'var'  : 'sxz',
                   },
	     '9' : {
		       'type' : 'update',
	               'var'  : 'syz',
                   },
                       }
	post_preamble = {
	     'n' : 0,
                        }
	boundary = {
	     '1-start'  : {
			    'rhs' : {
			             'n': 0 ,
                                    },
			    'var' : {
			             'n': 1 ,
                                     '1' : {
			                    'type' : 'manual',
			             	    'node' : 'ghost_and_boundary',
                                            'n' : 5,
	                                    '1' : {'lhs':'rho','equation':'1.'},
	                                    '2' : {'lhs':'rhu','equation':'rho*(1-g_y**2+0.3*(RANDOM-0.5))'},
	                                    '3' : {'lhs':'rhv','equation':'rho*(0.3*(RANDOM-0.5))'},
	                                    '4' : {'lhs':'rhw','equation':'rho*(0.3*(RANDOM-0.5))'},
	                                    '5' : {'lhs':'rhe','equation':'rho*(cvr*(tem-thz)+0.5*(rhu/rho)**2+0.5*(rhv/rho)**2+0.5*(rhw/rho)**2)'},
                                           },
                                    },
	                  } , 
	     '1-end'    : {
			    'rhs' : {
			             'n': 1 ,
                                     '1' : {
			                     'type' : 'manual',
			             	     'node' : 'boundary',
                                             'n' : 19,
		       			     '1' : {'lhs':'uuu','equation':'rhu/rho' },
		       			     '2' : {'lhs':'vvv','equation':'rhv/rho' },
		       			     '3' : {'lhs':'www','equation':'rhw/rho' },
		       			     '4' : {'lhs':'eee','equation':'rhe/rho' },
		       			     '5' : {'lhs':'tem','equation':'1./cvr*(eee-0.5*(uuu**2+vvv**2+www**2))+thz'},
	                                     '6' : {'lhs':'csp','equation':'sqrt(gam*rrr*tem)'},
	                                     '7' : {'lhs':'duu','equation':'(rhs_rhu-uuu*rhs_rho)/rho'},
	                                     '8' : {'lhs':'dvv','equation':'(rhs_rhv-vvv*rhs_rho)/rho'},
	                                     '9' : {'lhs':'dww','equation':'(rhs_rhw-www*rhs_rho)/rho'},
	                                     '10' : {'lhs':'dee','equation':'(rhs_rhe-eee*rhs_rho)/rho'},
	                                     '11' : {'lhs':'dth','equation':'1./cvr*(dee-uuu*duu-vvv*dvv-www*dww)'},
	                                     '12' : {'lhs':'dr1','equation':'duu+rrr/(rho*csp)*(rho*dth+tem*rhs_rho)'},
	                                     '13' : {'lhs':'duu','equation':'dr1*0.5'},
	                                     '14' : {'lhs':'rhs_rho','equation':'(rho*csp/rrr*duu-rho*dth)/tem'},
	                                     '15' : {'lhs':'rhs_rhu','equation':'uuu*rhs_rho+rho*duu'},
	                                     '16' : {'lhs':'rhs_rhv','equation':'vvv*rhs_rho+rho*dvv'},
	                                     '17' : {'lhs':'rhs_rhw','equation':'www*rhs_rho+rho*dww'},
	                                     '18' : {'lhs':'dee','equation':'cvr*dth+(uuu*duu+vvv*dvv+www*dww)'},
	                                     '19' : {'lhs':'rhs_rhe','equation':'eee*rhs_rho+rho*dee'},
                                           },
                                    },
			    'var' : {
			             'n': 1 ,
                                     '1' : {
			                     'type' : 'manual',
			             	     'node' : 'ghost',
                                             'n' : 5,
	                                     '1' : {'lhs':'rho','equation':'#[edx]{rho}'},
	                                     '2' : {'lhs':'rhe','equation':'#[edx]{rhe}'},
	                                     '3' : {'lhs':'rhu','equation':'#[edx]{rhu}'},
	                                     '4' : {'lhs':'rhv','equation':'#[edx]{rhv}'},
	                                     '5' : {'lhs':'rhw','equation':'#[edx]{rhw}'},
                                           },
                                    },
	                  } , 
	     '2-start'  : {
			    'rhs' : {
			             'n': 0 ,
                                    },
			    'var' : {
			             'n': 1 ,
                                     '1' : {
			                     'type' : 'manual',
			             	     'node' : 'ghost_and_boundary',
                                             'n' : 5,
	                                     '1' : {'lhs':'rho','equation':'1.'},
	                                     '2' : {'lhs':'rhe','equation':'rho*cvr*(the-thz)'},
	                                     '3' : {'lhs':'rhu','equation':'0.'},
	                                     '4' : {'lhs':'rhv','equation':'0.'},
	                                     '5' : {'lhs':'rhw','equation':'0.'},
                                           },
                                    },
	                  } , 
	     '2-end'    : {
                            'rhs' : {
                                      'n':0
                                    },
			    'var' : {
			             'n': 1 ,
                                     '1' : {
			                     'type' : 'manual',
			             	     'node' : 'ghost_and_boundary',
                                             'n' : 5,
	                                     '1' : {'lhs':'rho','equation':'1.'},
	                                     '2' : {'lhs':'rhe','equation':'rho*cvr*(the-thz)'},
	                                     '3' : {'lhs':'rhu','equation':'0.'},
	                                     '4' : {'lhs':'rhv','equation':'0.'},
	                                     '5' : {'lhs':'rhw','equation':'0.'},
                                           },
                                    },
	                  } , 
	     '3-start'  : {
			    'rhs' : {
			             'n': 0 ,
                                    },
			    'var' : {
			             'n': 1 ,
                                     '1' : {
			                    'type' : 'manual',
			             	    'node' : 'ghost',
                                            'n' : 5,
	                                    '1' : {'lhs':'rho','equation':'#[plz]{rho}'},
	                                    '2' : {'lhs':'rhu','equation':'#[plz]{rhu}'},
	                                    '3' : {'lhs':'rhv','equation':'#[plz]{rhv}'},
	                                    '4' : {'lhs':'rhw','equation':'#[plz]{rhw}'},
	                                    '5' : {'lhs':'rhe','equation':'#[plz]{rhe}'},
                                           },
                                    },
	                  } , 
	     '3-end'    : {
                            'rhs' : {
                                      'n':0
                                    },
			    'var' : {
			             'n': 1 ,
                                     '1' : {
			                    'type' : 'manual',
			             	    'node' : 'ghost',
                                            'n' : 5,
	                                    '1' : {'lhs':'rho','equation':'#[prz]{rho}'},
	                                    '2' : {'lhs':'rhu','equation':'#[prz]{rhu}'},
	                                    '3' : {'lhs':'rhv','equation':'#[prz]{rhv}'},
	                                    '4' : {'lhs':'rhw','equation':'#[prz]{rhw}'},
	                                    '5' : {'lhs':'rhe','equation':'#[prz]{rhe}'},
                                           },
                                    },
	                  } , 
                   }
#---------------------------------------------------------
# 3d example - triperiodic
#---------------------------------------------------------
if test_dim == '3d_triperiodic':
	random_ornot = "random_serial"
	mpi_periodic = {'1':'yes','2':'yes','3':'yes'}
	N_dim = 3 ; 
        N_equ = 5 ; 
        N_add_var = 13 ; 
        i_kutta = 5 
	
        add_variables = {
             'n' : N_add_var,
             '1' : {'symbol':'uuu','name':'u-vel'} ,
             '2' : {'symbol':'vvv','name':'v-vel'} ,
             '3' : {'symbol':'www','name':'w-vel'} ,
             '4' : {'symbol':'tem','name':'temperature'} ,
             '5' : {'symbol':'hhh','name':'enthalpy'} ,
             '6' : {'symbol':'pre','name':'pressure'} ,
             '7' : {'symbol':'div','name':'divergence of u'} ,
             '8' : {'symbol':'sxx','name':'viscous stress'} ,
             '9' : {'symbol':'syy','name':'viscous stress'} ,
             '10' : {'symbol':'szz','name':'viscous stress'} ,
             '11' : {'symbol':'sxy','name':'viscous stress'} ,
             '12' : {'symbol':'sxz','name':'viscous stress'} ,
             '13' : {'symbol':'syz','name':'viscous stress'} ,
        		}
        sca_variables = {
             '1' : {'symbol':'cvr','name':'constant volume specific heat'} ,
             '2' : {'symbol':'muu','name':'viscosity'} ,
             '3' : {'symbol':'rrr','name':'gas constant'} ,
             '4' : {'symbol':'thz','name':'temperature inf'} ,
             '5' : {'symbol':'kkk','name':'conductivity'} ,
             '6' : {'symbol':'eee','name':'energy'} ,
             '7' : {'symbol':'gam','name':'gas constant ratio'} ,
             '8' : {'symbol':'the','name':'temperature scalar'} ,
             '9' : {'symbol':'pig','name':'pi greco!'} ,
             '10' : {'symbol':'aff','name':'forcing in first mode'} ,
             '11' : {'symbol':'pha','name':'random phase a'} ,
             '12' : {'symbol':'phb','name':'random phase b'} ,
             '13' : {'symbol':'phc','name':'random phase c'} ,
             '14' : {'symbol':'phd','name':'random phase d'} ,
             '15' : {'symbol':'phe','name':'random phase e'} ,
             '16' : {'symbol':'phf','name':'random phase f'} ,
             '17' : {'symbol':'afi','name':'forcing amplitude'} ,
             '18' : {'symbol':'afl','name':'initial and forcing scale factor'} ,
		        }

	compact_operators = {}

	space_variables = { 
	     'n' : N_dim,
	     '1' : {'symbol':'x','name':'x coordinate','nt':16, 'ng':2,'L':6.283185308,'fun':'x','spacing':'uniform'},
	     '2' : {'symbol':'y','name':'y coordinate','nt':16, 'ng':2,'L':6.283185308,'fun':'y','spacing':'uniform'},
	     '3' : {'symbol':'z','name':'z coordinate','nt':16, 'ng':2,'L':6.283185308,'fun':'z','spacing':'uniform'}
	                  }
	variables = { 
	     'n' : N_equ,
	     '1' : {'symbol':'rho','name':'density'},
	     '2' : {'symbol':'rhu','name':'x-momentum'},
	     '3' : {'symbol':'rhv','name':'y-momentum'},
	     '4' : {'symbol':'rhw','name':'z-momentum'},
	     '5' : {'symbol':'rhe','name':'total energy'},
	            }
	initial = { 
	     'n' : N_equ,
	     '1' : '1.',
	     '2' : 'rho*afi*sin(afl*2.*pig/ly*g_y)*sin(afl*2.*pig/lz*g_z)',
	     '3' : 'rho*afi*sin(afl*2.*pig/lx*g_x)*sin(afl*2.*pig/lz*g_z)',
	     '4' : 'rho*afi*sin(afl*2.*pig/lx*g_x)*sin(afl*2.*pig/ly*g_y)',
	     '5' : 'rho*(cvr*(the-thz)+0.5*(rhu/rho)**2+0.5*(rhv/rho)**2+0.5*(rhw/rho)**2)',
	            }
	equations = {
	     'n' : N_equ,
	     '1' : {'equation':'-#[ddx]{rhu}-#[ddy]{rhv}-#[ddz]{rhw}'},
	     '2' : {'equation':'-0.5*(#[ddx]{rhu*uuu}+uuu*#[ddx]{rhu}+rhu*#[ddx]{uuu})-0.5*(#[ddy]{rhv*uuu}+uuu*#[ddy]{rhv}+rhv*#[ddy]{uuu})-0.5*(#[ddz]{rhw*uuu}+uuu*#[ddz]{rhw}+rhw*#[ddz]{uuu})-#[ddx]{pre}+muu*(#[dsx]{uuu}+#[dsy]{uuu}+#[dsz]{uuu})+muu/3.*#[ddx]{div}+aff*sin(afl*2.*pig/ly*g_y+pha)*sin(afl*2.*pig/lz*g_z+phb)'},
	     '3' : {'equation':'-0.5*(#[ddx]{rhu*vvv}+vvv*#[ddx]{rhu}+rhu*#[ddx]{vvv})-0.5*(#[ddy]{rhv*vvv}+vvv*#[ddy]{rhv}+rhv*#[ddy]{vvv})-0.5*(#[ddz]{rhw*vvv}+vvv*#[ddz]{rhw}+rhw*#[ddz]{vvv})-#[ddy]{pre}+muu*(#[dsx]{vvv}+#[dsy]{vvv}+#[dsz]{vvv})+muu/3*#[ddy]{div}+aff*sin(afl*2.*pig/lx*g_x+phc)*sin(afl*2.*pig/lz*g_z+phd)'},
	     '4' : {'equation':'-0.5*(#[ddx]{rhu*www}+www*#[ddx]{rhu}+rhu*#[ddx]{www})-0.5*(#[ddy]{rhv*www}+www*#[ddy]{rhv}+rhv*#[ddy]{www})-0.5*(#[ddz]{rhw*www}+www*#[ddz]{rhw}+rhw*#[ddz]{www})-#[ddz]{pre}+muu*(#[dsx]{www}+#[dsy]{www}+#[dsz]{www})+muu/3.*#[ddz]{div}+aff*sin(afl*2.*pig/lx*g_x+phe)*sin(afl*2.*pig/ly*g_y+phf)'},
	     '5' : {'equation':'-0.5*(#[ddx]{rhu*hhh}+hhh*#[ddx]{rhu}+rhu*#[ddx]{hhh})-0.5*(#[ddy]{rhv*hhh}+hhh*#[ddy]{rhv}+rhv*#[ddy]{hhh})-0.5*(#[ddz]{rhw*hhh}+hhh*#[ddz]{rhw}+rhw*#[ddz]{hhh})+kkk*(#[dsx]{tem}+#[dsy]{tem}+#[dsz]{tem})+#[ddx]{sxx*uuu+sxy*vvv+sxz*www}+#[ddy]{sxy*uuu+syy*vvv+syz*www}+#[ddz]{sxz*uuu+syz*vvv+szz*www}+aff*sin(afl*2.*pig/ly*g_y+pha)*sin(afl*2.*pig/lz*g_z+phb)*uuu+aff*sin(afl*2.*pig/lx*g_x+phc)*sin(afl*2.*pig/lz*g_z+phd)*vvv+aff*sin(afl*2.*pig/lx*g_x+phe)*sin(afl*2.*pig/ly*g_y+phf)*www'},
	            }
	ini_preamble = {
             'n' : 1,
	     '1' :         {
		               'type' : 'scalar',
		               'n':11,
	                       '1': {'lhs':'gam', 'equation':'1.4'},
	                       '2': {'lhs':'cvr', 'equation':'716.'},
	                       '3': {'lhs':'muu', 'equation':'0.01'},
	                       '4': {'lhs':'rrr', 'equation':'287.'},
	                       '5': {'lhs':'thz', 'equation':'1.'},
	                       '6': {'lhs':'kkk', 'equation':'1388.*muu'},
	                       '7': {'lhs':'the', 'equation':'0.06'},
	                       '8': {'lhs':'pig', 'equation':'acos(-1.)'},
	                       '9': {'lhs':'aff', 'equation':'8.'},
	                       '10': {'lhs':'afi', 'equation':'1.'},
	                       '11': {'lhs':'afl', 'equation':'1.'},
	                   },
#	     '2' :         {
#		               'type' : 'ghost',
#		               'n':4,
#	                       '1': {'lhs':'tem', 'equation':'the'},
#	                       '2': {'lhs':'uuu', 'equation':'0.'},
#	                       '3': {'lhs':'vvv', 'equation':'0.'},
#	                       '4': {'lhs':'www', 'equation':'0.'},
#	                       '2': {'lhs':'uuu', 'equation':'0.1*sin(2*pig/ly*g_y)*cos(2.*pig/lx*g_x)*sin(2*pig/lz*g_z)'},
#	                       '3': {'lhs':'vvv', 'equation':'0.1*cos(2*pig/ly*g_y)*sin(2.*pig/lx*g_x)*sin(2*pig/lz*g_z)'},
#	                       '4': {'lhs':'www', 'equation':'0.1*sin(2*pig/lx*g_x)*sin(2.*pig/ly*g_y)*cos(2*pig/lz*g_z)'},
#	                       '2': {'lhs':'uuu', 'equation':'0.1*2*acos(-1.)*sin(acos(-1.)*(g_y-1.))*cos(g_x)*sin(g_z)'},
#	                       '3': {'lhs':'vvv', 'equation':'-0.1*(1.+cos(acos(-1.)*(g_y-1)))*sin(g_x)*sin(g_z)'},
#	                       '4': {'lhs':'www', 'equation':'0.1*acos(-1.)*sin(g_x)*sin(acos(-1.)*(g_y-1.))*cos(g_z)'},
#	                       '2': {'lhs':'uuu', 'equation':'0.2*(RANDOM-.5)'},
#	                       '3': {'lhs':'vvv', 'equation':'0.2*(RANDOM-.5)'},
#	                       '4': {'lhs':'www', 'equation':'0.2*(RANDOM-.5)'},
#	                   },
                       }
	rhs_preamble = {
             'n' : 10,
	     '1' : {
		       'type' : 'ghost',
		       'n':7,
	               '1': {'lhs':'uuu', 'equation':'rhu/rho'},
	               '2': {'lhs':'vvv', 'equation':'rhv/rho'},
	               '3': {'lhs':'www', 'equation':'rhw/rho'},
	               '4': {'lhs':'eee', 'equation':'rhe/rho'},
	               '5': {'lhs':'tem', 'equation':'1./cvr*(eee-0.5*(uuu*uuu+vvv*vvv+www*www))+thz'},
	               '6': {'lhs':'hhh', 'equation':'eee+tem*rrr'},
	               '7': {'lhs':'pre', 'equation':'rho*rrr*tem'},
                   },
	     '2' : {
		       'type' : 'internal',
		       'n':7,
	               '1': {'lhs':'div', 'equation':'#[ddx]{uuu}+#[ddy]{vvv}+#[ddz]{www}'},
	               '2': {'lhs':'sxx', 'equation':'2.*muu*#[ddx]{uuu}-2./3.*muu*div'},
	               '3': {'lhs':'syy', 'equation':'2.*muu*#[ddy]{vvv}-2./3.*muu*div'},
	               '4': {'lhs':'szz', 'equation':'2.*muu*#[ddz]{www}-2./3.*muu*div'},
	               '5': {'lhs':'sxy', 'equation':'muu*(#[ddy]{uuu}+#[ddx]{vvv})'},
	               '6': {'lhs':'sxz', 'equation':'muu*(#[ddz]{uuu}+#[ddx]{www})'},
	               '7': {'lhs':'syz', 'equation':'muu*(#[ddz]{vvv}+#[ddy]{www})'},
                   },
	     '3' : {
		       'type' : 'update',
	               'var'  : 'div',
                   },
	     '4' : {
		       'type' : 'update',
	               'var'  : 'sxx',
                   },
	     '5' : {
		       'type' : 'update',
	               'var'  : 'syy',
                   },
	     '6' : {
		       'type' : 'update',
	               'var'  : 'szz',
                   },
	     '7' : {
		       'type' : 'update',
	               'var'  : 'sxy',
                   },
	     '8' : {
		       'type' : 'update',
	               'var'  : 'sxz',
                   },
	     '9' : {
		       'type' : 'update',
	               'var'  : 'syz',
                   },
	     '10' : {
		       'type' : 'scalar',
		       'n':6,
	               '1': {'lhs':'pha', 'equation':'2*pig*RANDOM'},
	               '2': {'lhs':'phb', 'equation':'2*pig*RANDOM'},
	               '3': {'lhs':'phc', 'equation':'2*pig*RANDOM'},
	               '4': {'lhs':'phd', 'equation':'2*pig*RANDOM'},
	               '5': {'lhs':'phe', 'equation':'2*pig*RANDOM'},
	               '6': {'lhs':'phf', 'equation':'2*pig*RANDOM'},
                   },
                       }
	post_preamble = {
	     'n' : 0,
                        }
	boundary = {
	     '1-start'  : {
			    'rhs' : {
			             'n': 0 ,
                                    },
			    'var' : {
			             'n': 1 ,
                                     '1' : {
			                    'type' : 'manual',
			             	    'node' : 'ghost',
                                            'n' : 5,
	                                    '1' : {'lhs':'rho','equation':'#[plx]{rho}'},
	                                    '2' : {'lhs':'rhu','equation':'#[plx]{rhu}'},
	                                    '3' : {'lhs':'rhv','equation':'#[plx]{rhv}'},
	                                    '4' : {'lhs':'rhw','equation':'#[plx]{rhw}'},
	                                    '5' : {'lhs':'rhe','equation':'#[plx]{rhe}'},
                                           },
                                    },
	                  } , 
	     '1-end'    : {
                            'rhs' : {
                                      'n':0
                                    },
			    'var' : {
			             'n': 1 ,
                                     '1' : {
			                    'type' : 'manual',
			             	    'node' : 'ghost',
                                            'n' : 5,
	                                    '1' : {'lhs':'rho','equation':'#[prx]{rho}'},
	                                    '2' : {'lhs':'rhu','equation':'#[prx]{rhu}'},
	                                    '3' : {'lhs':'rhv','equation':'#[prx]{rhv}'},
	                                    '4' : {'lhs':'rhw','equation':'#[prx]{rhw}'},
	                                    '5' : {'lhs':'rhe','equation':'#[prx]{rhe}'},
                                           },
                                    },
	                  } , 
	     '2-start'  : {
			    'rhs' : {
			             'n': 0 ,
                                    },
			    'var' : {
			             'n': 1 ,
                                     '1' : {
			                    'type' : 'manual',
			             	    'node' : 'ghost',
                                            'n' : 5,
	                                    '1' : {'lhs':'rho','equation':'#[ply]{rho}'},
	                                    '2' : {'lhs':'rhu','equation':'#[ply]{rhu}'},
	                                    '3' : {'lhs':'rhv','equation':'#[ply]{rhv}'},
	                                    '4' : {'lhs':'rhw','equation':'#[ply]{rhw}'},
	                                    '5' : {'lhs':'rhe','equation':'#[ply]{rhe}'},
                                           },
                                    },
	                  } , 
	     '2-end'    : {
                            'rhs' : {
                                      'n':0
                                    },
			    'var' : {
			             'n': 1 ,
                                     '1' : {
			                    'type' : 'manual',
			             	    'node' : 'ghost',
                                            'n' : 5,
	                                    '1' : {'lhs':'rho','equation':'#[pry]{rho}'},
	                                    '2' : {'lhs':'rhu','equation':'#[pry]{rhu}'},
	                                    '3' : {'lhs':'rhv','equation':'#[pry]{rhv}'},
	                                    '4' : {'lhs':'rhw','equation':'#[pry]{rhw}'},
	                                    '5' : {'lhs':'rhe','equation':'#[pry]{rhe}'},
                                           },
                                    },
	                  } , 
	     '3-start'  : {
			    'rhs' : {
			             'n': 0 ,
                                    },
			    'var' : {
			             'n': 1 ,
                                     '1' : {
			                    'type' : 'manual',
			             	    'node' : 'ghost',
                                            'n' : 5,
	                                    '1' : {'lhs':'rho','equation':'#[plz]{rho}'},
	                                    '2' : {'lhs':'rhu','equation':'#[plz]{rhu}'},
	                                    '3' : {'lhs':'rhv','equation':'#[plz]{rhv}'},
	                                    '4' : {'lhs':'rhw','equation':'#[plz]{rhw}'},
	                                    '5' : {'lhs':'rhe','equation':'#[plz]{rhe}'},
                                           },
                                    },
	                  } , 
	     '3-end'    : {
                            'rhs' : {
                                      'n':0
                                    },
			    'var' : {
			             'n': 1 ,
                                     '1' : {
			                    'type' : 'manual',
			             	    'node' : 'ghost',
                                            'n' : 5,
	                                    '1' : {'lhs':'rho','equation':'#[prz]{rho}'},
	                                    '2' : {'lhs':'rhu','equation':'#[prz]{rhu}'},
	                                    '3' : {'lhs':'rhv','equation':'#[prz]{rhv}'},
	                                    '4' : {'lhs':'rhw','equation':'#[prz]{rhw}'},
	                                    '5' : {'lhs':'rhe','equation':'#[prz]{rhe}'},
                                           },
                                    },
	                  } , 
                   }

	exchange_data = { 
	     'space_var'        : 'x',
	     'point_index_send' : 12,
	     'var_send'         : 'yes',
# for turbulent flame
	     'rhs_send'         : 'yes',
# for decaying turbulence
#	     'rhs_send'         : 'no',
	     'n_var_recv'       : 0,
	     'n_rhs_recv'       : 0
	                  }

#---------------------------------------------------------
# 3d example - 3d Deflagration wave
#---------------------------------------------------------
if test_dim == '3d_deflagration_wave':
	random_ornot = "random_no"
	mpi_periodic = {'1':'no','2':'yes','3':'yes'}
	N_dim = 3 ; 
        N_equ = 6 ; 
        N_add_var = 15 ; 
        i_kutta = 5 
	
        add_variables = {
             'n' : N_add_var,
             '1' : {'symbol':'uuu','name':'u-vel'} ,
             '2' : {'symbol':'vvv','name':'v-vel'} ,
             '3' : {'symbol':'www','name':'w-vel'} ,
             '4' : {'symbol':'tem','name':'temperature'} ,
             '5' : {'symbol':'hhh','name':'enthalpy'} ,
             '6' : {'symbol':'pre','name':'pressure'} ,
             '7' : {'symbol':'div','name':'divergence of u'} ,
             '8' : {'symbol':'sxx','name':'viscous stress'} ,
             '9' : {'symbol':'syy','name':'viscous stress'} ,
            '10' : {'symbol':'szz','name':'viscous stress'} ,
            '11' : {'symbol':'sxy','name':'viscous stress'} ,
            '12' : {'symbol':'sxz','name':'viscous stress'} ,
            '13' : {'symbol':'syz','name':'viscous stress'} ,
	    '14' : {'symbol':'wwx','name':'reaction rate'} ,
	    '15' : {'symbol':'yya','name':'specie a'} ,
          #  '16' : {'symbol':'det','name':'deta/dy'} ,
          #  '17' : {'symbol':'deq','name':'(deta/dy)**2'} ,
          #  '18' : {'symbol':'ded','name':'d2eta/dy2'} ,
        		}
        sca_variables = {
             '1' : {'symbol':'cvr','name':'initial pressure'} ,
             '2' : {'symbol':'muu','name':'viscosity'} ,
             '3' : {'symbol':'rrr','name':'gas constant'} ,
             '4' : {'symbol':'thz','name':'temperature inf'} ,
             '5' : {'symbol':'kkk','name':'conductivity'} ,
             '6' : {'symbol':'eee','name':'energy'} ,
             '7' : {'symbol':'dpx','name':'zero pressure gradient'} ,
             '8' : {'symbol':'gam','name':'gas constant ratio'} ,
             '9' : {'symbol':'the','name':'temperature scalar'} ,
             '10' : {'symbol':'pig','name':'pi greco!'} ,
             '11' : {'symbol':'csp','name':'sound speed'} ,
             '12' : {'symbol':'duu','name':'d(u) for bc'} ,
             '13' : {'symbol':'dee','name':'d(e) for bc'} ,
             '14' : {'symbol':'dr1','name':'first riemann wave'} ,
             '15' : {'symbol':'dth','name':'d(theta) for bc'} ,
             '16' : {'symbol':'dvv','name':'d(theta) for bc'} ,
             '17' : {'symbol':'dww','name':'d(theta) for bc'} ,
             '18' : {'symbol':'uin','name':'average inlet velocity'} ,
	     '19' : {'symbol':'dha','name':'enthalpy a'} ,
	     '20' : {'symbol':'pra','name':'prandtl'} ,
	     '21' : {'symbol':'lew','name':'lewis'} ,
	     '22' : {'symbol':'dam','name':'damkholer'} ,
	     '23' : {'symbol':'zel','name':'zeldovich'} ,
	     '24' : {'symbol':'dya','name':'d(ya) for bc'} ,
	     '25' : {'symbol':'xfn','name':'flame front abscissa new'} ,
	     '26' : {'symbol':'xan','name':'achoring flame front abscissa'} ,
	     '27' : {'symbol':'xfo','name':'flame front abscissa old'},
	     '28' : {'symbol':'vfr','name':'flame front velocity'} ,
	     '29' : {'symbol':'wma','name':'maximum reaction rate'} ,
	     '30' : {'symbol':'aaa','name':'for interpolation '} ,
	     '31' : {'symbol':'bbb','name':'for interpolation'} ,
	     '32' : {'symbol':'ccc','name':'for interpolation'} ,
	     '33' : {'symbol':'xsx','name':'for interpolation'} ,
	     '34' : {'symbol':'xdx','name':'for interpolation'} ,
	     '35' : {'symbol':'wms','name':'for interpolation'} ,
	     '36' : {'symbol':'wmd','name':'for interpolation'} ,
	     '37' : {'symbol':'pp1','name':'for interpolation'} ,
	     '38' : {'symbol':'pp2','name':'for interpolation'} ,
	     '39' : {'symbol':'pp3','name':'for interpolation'} ,
	     '40' : {'symbol':'vbl','name':'v_blow'} ,
	     '41' : {'symbol':'dr2','name':'second riemann wave'} ,
	     '42' : {'symbol':'rhi','name':'inlet rho averaged'} ,
	     '43' : {'symbol':'ryi','name':'inlet rya averaged'} ,
	     '44' : {'symbol':'rui','name':'inlet rhu averaged'} ,
	     '45' : {'symbol':'win','name':'integral velocity'} ,
	     '46' : {'symbol':'sea','name':'flame started'} ,
	     '47' : {'symbol':'xfs','name':'flame starting ascissa x'} ,
	     '48' : {'symbol':'xdu','name':'x_due (right of starting ascissa x)'} ,
	     '49' : {'symbol':'xun','name':'x_uno (right of starting ascissa x)'} ,
	     '50' : {'symbol':'tdu','name':'t_due (right tem of starting ascissa x)'} ,
	     '51' : {'symbol':'tun','name':'t_uno (right tem of starting ascissa x)'} ,
	     '52' : {'symbol':'tfs','name':'tem starting flame'} ,
	     '53' : {'symbol':'vla','name':'laminar flame speed'} ,
	     '54' : {'symbol':'res','name':'rescaling factor of inlet turbulence'} ,
	     '55' : {'symbol':'mtr','name':'triperiodic viscosity'} ,
		        }

	compact_operators = {}

	space_variables = { 
	     'n' : N_dim,
	     '1' : {'symbol':'x','name':'streamwise coordinate','nt':512, 'ng':2,'L':25.1,'fun':'x','spacing':'uniform'},
	     '2' : {'symbol':'y','name':'spanwise coordinate 1','nt':16,  'ng':2,'L':6.28,'fun':'y','spacing':'uniform'},
	     '3' : {'symbol':'z','name':'spanwise coordinate 2','nt':16,  'ng':2,'L':6.28,'fun':'z','spacing':'uniform'}
	                  }
	variables = { 
	     'n' : N_equ,
	     '1' : {'symbol':'rho','name':'density'},
	     '2' : {'symbol':'rhu','name':'x-momentum'},
	     '3' : {'symbol':'rhv','name':'y-momentum'},
	     '4' : {'symbol':'rhw','name':'z-momentum'},
	     '5' : {'symbol':'rhe','name':'total energy'},
	     '6' : {'symbol':'rya','name':'mass fraction a'},
	            }
	initial = { 
	     'n' : N_equ,
	     '1' : '1.',
	     '2' : 'rho*uin',
	     '3' : '0.',
	     '4' : '0.',
	     '5' : 'rho*(1./gam*(tem-1.)+yya*dha+0.5*(rhu/rho)**2+0.5*(rhv/rho)**2+0.5*(rhw/rho)**2)',
	     '6' : '0.',
	            }
	equations = {
	     'n' : N_equ,
	     '1' : {'equation':'-#[ddx]{rhu}-#[ddy]{rhv}-#[ddz]{rhw}'},
	     '2' : {'equation':'-0.5*(#[ddx]{rhu*uuu}+uuu*#[ddx]{rhu}+rhu*#[ddx]{uuu})-0.5*(#[ddy]{rhv*uuu}+uuu*#[ddy]{rhv}+rhv*#[ddy]{uuu})-0.5*(#[ddz]{rhw*uuu}+uuu*#[ddz]{rhw}+rhw*#[ddz]{uuu})-#[ddx]{pre}+pra*(#[dsx]{uuu}+#[dsy]{uuu}+#[dsz]{uuu})+pra/3.*#[ddx]{div}'},
	     '3' : {'equation':'-0.5*(#[ddx]{rhu*vvv}+vvv*#[ddx]{rhu}+rhu*#[ddx]{vvv})-0.5*(#[ddy]{rhv*vvv}+vvv*#[ddy]{rhv}+rhv*#[ddy]{vvv})-0.5*(#[ddz]{rhw*vvv}+vvv*#[ddz]{rhw}+rhw*#[ddz]{vvv})-#[ddy]{pre}+pra*(#[dsx]{vvv}+#[dsy]{vvv}+#[dsz]{vvv})+pra/3*#[ddy]{div}'},
	     '4' : {'equation':'-0.5*(#[ddx]{rhu*www}+www*#[ddx]{rhu}+rhu*#[ddx]{www})-0.5*(#[ddy]{rhv*www}+www*#[ddy]{rhv}+rhv*#[ddy]{www})-0.5*(#[ddz]{rhw*www}+www*#[ddz]{rhw}+rhw*#[ddz]{www})-#[ddz]{pre}+pra*(#[dsx]{www}+#[dsy]{www}+#[dsz]{www})+pra/3.*#[ddz]{div}'},
	     '5' : {'equation':'-0.5*(#[ddx]{rhu*hhh}+hhh*#[ddx]{rhu}+rhu*#[ddx]{hhh})-0.5*(#[ddy]{rhv*hhh}+hhh*#[ddy]{rhv}+rhv*#[ddy]{hhh})-0.5*(#[ddz]{rhw*hhh}+hhh*#[ddz]{rhw}+rhw*#[ddz]{hhh})+(#[dsx]{tem}+#[dsy]{tem}+#[dsz]{tem})+dha/lew*(#[dsx]{yya}+#[dsy]{yya}+#[dsz]{yya})+#[ddx]{sxx*uuu+sxy*vvv+sxz*www}+#[ddy]{sxy*uuu+syy*vvv+syz*www}+#[ddz]{sxz*uuu+syz*vvv+szz*www}'},
	     '6' : {'equation':'-0.5*(#[ddx]{rya*uuu}+yya*#[ddx]{rhu}+rhu*#[ddx]{yya})-0.5*(#[ddy]{rya*vvv}+yya*#[ddy]{rhv}+rhv*#[ddy]{yya})-0.5*(#[ddz]{rya*www}+yya*#[ddz]{rhw}+rhw*#[ddz]{yya})+1./lew*(#[dsx]{yya}+#[dsy]{yya}+#[dsz]{yya})-wwx'},
	            }
	ini_preamble = {
             'n' : 1,
	     '1' :         {
		               'type' : 'scalar',
		               'n':16,
	                       '1': {'lhs':'pig', 'equation':'acos(-1.)'},
	                       '2': {'lhs':'uin', 'equation':'1.'},
                               '3': {'lhs':'gam', 'equation':'1.32'},
                               '4': {'lhs':'dha', 'equation':'10000.'},
                               '5': {'lhs':'pra', 'equation':'0.74'},
                               '6': {'lhs':'lew', 'equation':'1.'},
                               '7': {'lhs':'dam', 'equation':'1800.'},
                               '8': {'lhs':'zel', 'equation':'1060.'},
                               '9': {'lhs':'xfn', 'equation':'0.4*lx'},
                              '10': {'lhs':'xfo', 'equation':'0.4*lx'},
                              '11': {'lhs':'vfr', 'equation':'0.'},
                              '12': {'lhs':'xan', 'equation':'0.4*lx'},
                              '13': {'lhs':'vla', 'equation':'0.005128'},
                              '14': {'lhs':'tfs', 'equation':'250.'},
                              '15': {'lhs':'mtr', 'equation':'0.01'},
                              '16': {'lhs':'res', 'equation':'(6.2830 / ly) * (pra/ mtr ) / 492.90237'},
	                   },
                       }
	rhs_preamble = {
             'n' : 9,
	     '1' : {
		       'type' : 'ghost',
		       'n':9,
	               '1': {'lhs':'uuu', 'equation':'rhu/rho'},
	               '2': {'lhs':'vvv', 'equation':'rhv/rho'},
	               '3': {'lhs':'www', 'equation':'rhw/rho'},
	               '4': {'lhs':'eee', 'equation':'rhe/rho'},
	               '5': {'lhs':'tem', 'equation':'gam*((rhe-rya*dha)/rho-0.5*(uuu**2+vvv**2+www**2))+1.'},
	               '6': {'lhs':'hhh', 'equation':'eee+(gam-1.)/gam*tem'},
	               '7': {'lhs':'pre', 'equation':'(gam-1.)/gam*rho*tem'},
		       '8': {'lhs':'wwx', 'equation':'dam*rya*exp(-zel/tem*gam/(gam-1.))'},
		       '9': {'lhs':'yya', 'equation':'rya/rho'},
                   },
	     '2' : {
		       'type' : 'internal',
		       'n':7,
	               '1': {'lhs':'div', 'equation':'#[ddx]{uuu}+#[ddy]{vvv}+#[ddz]{www}'},
	               '2': {'lhs':'sxx', 'equation':'2.*pra*#[ddx]{uuu}-2./3.*pra*div'},
	               '3': {'lhs':'syy', 'equation':'2.*pra*#[ddy]{vvv}-2./3.*pra*div'},
	               '4': {'lhs':'szz', 'equation':'2.*pra*#[ddz]{www}-2./3.*pra*div'},
	               '5': {'lhs':'sxy', 'equation':'pra*(#[ddy]{uuu}+#[ddx]{vvv})'},
	               '6': {'lhs':'sxz', 'equation':'pra*(#[ddz]{uuu}+#[ddx]{www})'},
	               '7': {'lhs':'syz', 'equation':'pra*(#[ddz]{vvv}+#[ddy]{www})'},
                   },
	     '3' : {
		       'type' : 'update',
	               'var'  : 'div',
                   },
	     '4' : {
		       'type' : 'update',
	               'var'  : 'sxx',
                   },
	     '5' : {
		       'type' : 'update',
	               'var'  : 'syy',
                   },
	     '6' : {
		       'type' : 'update',
	               'var'  : 'szz',
                   },
	     '7' : {
		       'type' : 'update',
	               'var'  : 'sxy',
                   },
	     '8' : {
		       'type' : 'update',
	               'var'  : 'sxz',
                   },
	     '9' : {
		       'type' : 'update',
	               'var'  : 'syz',
                   },
                       }
	post_preamble = {
             'n' : 12,
	     '1' : {
		       'type' : 'scalar',
		       'n': 10,
	               '1': {'lhs':'win', 'equation':'0.'},
	               '2': {'lhs':'sea', 'equation':'1.'},
	               '3': {'lhs':'rhi', 'equation':'0.'},
	               '4': {'lhs':'ryi', 'equation':'0.'},
	               '5': {'lhs':'rui', 'equation':'0.'},
	               '6': {'lhs':'xfs', 'equation':'huge(0.)'},
	               '7': {'lhs':'tun', 'equation':'huge(0.)'},
	               '8': {'lhs':'tdu', 'equation':'huge(0.)'},
	               '9': {'lhs':'xun', 'equation':'huge(0.)'},
	              '10': {'lhs':'xdu', 'equation':'huge(0.)'},
                   },
	     '2' : {
		       'type' : 'internal',
		       'n' : 3,
		       '1' : { 'lhs':'if(i_x.eq.1) rhi', 'equation':'rhi+rho' },
		       '2' : { 'lhs':'if(i_x.eq.1) ryi', 'equation':'ryi+rya' },
		       '3' : { 'lhs':'if(i_x.eq.1) rui', 'equation':'rui+rhu' },
#                              LIMITARE LA MEDIA AL PIANO INIZIALE (I_X=1) E  METTERE REDUCTION (SUM)
	           },
	     '3' : {
		       'type' : 'sum_scalar_reduction',
		       'var'  : 'rhi'
	           },
	     '4' : {
		       'type' : 'sum_scalar_reduction',
		       'var'  : 'ryi'
	           },
	     '5' : {
		       'type' : 'sum_scalar_reduction',
		       'var'  : 'rui'
	           },
	     '6' : {
		       'type' : 'internal',
		       'n' : 6,
		       '1' : { 'lhs':'uuu', 'equation':'rhu/rho' },
		       '2' : { 'lhs':'vvv', 'equation':'rhv/rho' },
		       '3' : { 'lhs':'www', 'equation':'rhw/rho' },
		       '4' : { 'lhs':'tem', 'equation':'gam*((rhe-rya*dha)/rho-0.5*(uuu**2+vvv**2+www**2))+1.'},
		       '5' : { 'lhs':'wwx', 'equation':'dam*rya*exp(-zel/tem*gam/(gam-1.))'},
		       '6' : { 'lhs':'win', 'equation':'win+wwx'},
#                              AGGIUNGERE REDUCTION DI WIN (SUM)
	           },
	     '7' : {
		       'type' : 'sum_scalar_reduction',
		       'var'  : 'win'
	           },
# cose da modificare in fiamma 1d: 
# 1) sxs=ecx non edx...  
# 2) (provare) v ingresso pari a quella soffiata al passo prima
	     '8' : {
		       'type' : 'internal',
		       'n' : 5,
		       '1' : { 'lhs':'if((tem.gt.tfs).and.(sea.ge.0)) xdu', 'equation':'g_x'},
		       '2' : { 'lhs':'if((tem.gt.tfs).and.(sea.ge.0)) xun', 'equation':'#[edx]{g_x}'},
		       '3' : { 'lhs':'if((tem.gt.tfs).and.(sea.ge.0)) tdu', 'equation':'tem'},
		       '4' : { 'lhs':'if((tem.gt.tfs).and.(sea.ge.0)) tun', 'equation':'#[edx]{tem}'},
		       '5' : { 'lhs':'if((tem.gt.tfs).and.(sea.ge.0)) sea', 'equation':'-1.'},
	           },
	     '9' : {
		       'type' : 'scalar',
		       'n' : 5,
		       '1' : {'lhs':'rhi', 'equation':'rhi/(nt_y*nt_z)' },
		       '2' : {'lhs':'ryi', 'equation':'ryi/(nt_y*nt_z)' },
		       '3' : {'lhs':'rui', 'equation':'rui/(nt_y*nt_z)' },
                       '4' : {'lhs':'win' ,'equation':'win*lx/ryi/nt_x/nt_y/nt_z'}, # strano...
		       '5' : {'lhs':'if(xun < huge(1.0)) xfs' ,'equation':'xun+(tfs-tun)/(tdu-tun)*(xdu-xun)'},
#                          AGGIUNGERE REDUCTION DI XFS (MIN)
                   },
	     '10' : {
		       'type' : 'min_scalar_reduction',
		       'var'  : 'xfs'
	           },
	     '11' : {
		       'type' : 'scalar',
		       'n' : 2,
		       '1' : {'lhs':'vbl', 'equation':'0.0001*(xan-xfs)-0.001*(rui/rhi-win)' },
		       '2' : {'lhs':'if(rui/rhi+vbl.lt.0.25*vla) vbl', 'equation':'-(rui/rhi-0.25*vla)' },
                   },
	     '12' : {
		       'type' : 'ghost',
		       'n' : 2,
		       '1' : { 'lhs':'rhu', 'equation':'rhu+rho*vbl' },
		       '2' : { 'lhs':'rhe', 'equation':'rhe+0.5*rho*(vbl**2+2.*rhu/rho*vbl)' },
                   },
                      }
	boundary = {
	     '1-start'  : {
			    'rhs' : {
			             'n': 1 ,
                                     '1' : {
			                     'type' : 'manual',
			             	     'node' : 'boundary',
                                             'n' : 23,
	                                     '1' : {'lhs':'uuu','equation':'rhu/rho'},
	                                     '2' : {'lhs':'vvv','equation':'rhv/rho'},
	                                     '3' : {'lhs':'www','equation':'rhw/rho'},
	                                     '4' : {'lhs':'yya','equation':'rya/rho'},
	                                     '5' : {'lhs':'tem','equation':'gam*((rhe-rya*dha)/rho-0.5*(uuu**2+vvv**2+www**2)+1.)'},
	                                     '6' : {'lhs':'csp','equation':'sqrt((gam-1.)*tem)'},
	                                     '7' : {'lhs':'dya','equation':'rhs_rya/rho-rya/rho**2*rhs_rho'},
	                                     '8' : {'lhs':'duu','equation':'rhs_rhu/rho-rhu/rho**2*rhs_rho'},
	                                     '9' : {'lhs':'dvv','equation':'rhs_rhv/rho-rhv/rho**2*rhs_rho'},
	                                    '10' : {'lhs':'dww','equation':'rhs_rhw/rho-rhw/rho**2*rhs_rho'},
	                                    '11' : {'lhs':'dee','equation':'rhs_rhe/rho-rhe/rho**2*rhs_rho'},
	                                    '12' : {'lhs':'dth','equation':'gam*(dee-uuu*duu-vvv*dvv-www*dww-dha*dya)'},
	                                    '13' : {'lhs':'dr1','equation':'duu-(gam-1.)/(gam*csp)*(dth+tem/rho*rhs_rho)'},
	                                    #1'14' : {'lhs':'duu','equation':'0.'},
	                                    #1'15' : {'lhs':'dvv','equation':'0.'},
	                                    #1'16' : {'lhs':'dww','equation':'0.'},
	                                    #2'14' : {'lhs':'duu','equation':'res*EXC_VAR_2-uuu'},
	                                    #2'15' : {'lhs':'dvv','equation':'res*EXC_VAR_3-vvv'},
	                                    #2'16' : {'lhs':'dww','equation':'res*EXC_VAR_4-www'},
	                                    '14' : {'lhs':'duu','equation':'res*EXC_RHS_2'},
	                                    '15' : {'lhs':'dvv','equation':'res*EXC_RHS_3'},
	                                    '16' : {'lhs':'dww','equation':'res*EXC_RHS_4'},
	                                    '17' : {'lhs':'rhs_rho','equation':'rho*csp/(((gam-1.)/gam)*tem)*(duu-dr1)'},
	                                    '18' : {'lhs':'dee','equation':'uuu*duu+vvv*dvv+www*dww'},
	                                    '19' : {'lhs':'rhs_rhu','equation':'rho*duu+uuu*rhs_rho'},
	                                    '20' : {'lhs':'rhs_rhe','equation':'rhe/rho*rhs_rho+rho*dee'},
	                                    '21' : {'lhs':'rhs_rya','equation':'yya*rhs_rho'},
	                                    '22' : {'lhs':'rhs_rhv','equation':'vvv*rhs_rho+rho*dvv'},
	                                    '23' : {'lhs':'rhs_rhw','equation':'www*rhs_rho+rho*dww'},
                                          }
                                    },
			    'var' : {
			             'n': 1 ,
                                     '1' : {
			                     'type' : 'manual',
			             	     'node' : 'ghost',
                                             'n' : 6,

	                                     '1' : {'lhs':'rho','equation':'#[ecx]{rho}'},
	                                     '2' : {'lhs':'rhu','equation':'#[ecx]{rhu}'},
	                                     '3' : {'lhs':'rhe','equation':'#[ecx]{rhe}'},
	                                     '4' : {'lhs':'rya','equation':'#[ecx]{rya}'},
	                                     '5' : {'lhs':'rhv','equation':'#[ecx]{rhv}'},
	                                     '6' : {'lhs':'rhw','equation':'#[ecx]{rhw}'},

	                                     #'1' : {'lhs':'uuu','equation':'rhu/rho'},
	                                     #'2' : {'lhs':'vvv','equation':'rhv/rho'},
	                                     #'3' : {'lhs':'www','equation':'rhw/rho'},
	                                     #'4' : {'lhs':'yya','equation':'rya/rho'},
	                                     #'5' : {'lhs':'tem','equation':'gam*((rhe-rya*dha)/rho-0.5*(uuu**2+vvv**2+www**2)+1.)'},
	                                     #'6' : {'lhs':'rho','equation':'rho*tem/86.3'},
	                                     #'7' : {'lhs':'rya','equation':'rho*0.054861'},
	                                     #'8' : {'lhs':'rhu','equation':'#[ecx]{uuu}*rho'},
	                                     #'9' : {'lhs':'rhv','equation':'0.'},
	                                     #'10' : {'lhs':'rhw','equation':'0.'},
	                                     #'11' : {'lhs':'tem','equation':'86.3'},
	                                     #'12' : {'lhs':'rhe','equation':'rho*(1./gam*(tem-1.)+(rya/rho)*dha+0.5*((rhu/rho)**2+(rhv/rho)**2+(rhw/rho)**2))'}

	                                     #'1' : {'lhs':'rho','equation':'EXC_VAR_1'},
	                                     #'2' : {'lhs':'rhu','equation':'EXC_VAR_2+EXC_VAR_1*uin'},
	                                     #'3' : {'lhs':'rhv','equation':'EXC_VAR_3'},
	                                     #'4' : {'lhs':'rhw','equation':'EXC_VAR_4'},
	                                     #'5' : {'lhs':'rhe','equation':'EXC_VAR_5+0.5*(rho*uin**2+2.*rhu*uin)'},
                                           }
                                    },
	                  } , 
	     '1-end'    : {
			    'rhs' : {
			             'n': 0 ,
                                     '1' : {
			                     'type' : 'manual',
			             	     'node' : 'boundary',
                                             'n' : 19,
		       			     '1' : {'lhs':'uuu','equation':'rhu/rho' },
		       			     '2' : {'lhs':'vvv','equation':'rhv/rho' },
		       			     '3' : {'lhs':'www','equation':'rhw/rho' },
		       			     '4' : {'lhs':'eee','equation':'rhe/rho' },
	                                     '5' : {'lhs':'yya','equation':'rya/rho'},
	                                     '6' : {'lhs':'tem','equation':'gam*((rhe-rya*dha)/rho-0.5*(uuu**2+vvv**2+www**2)+1.'},
	                                     '6' : {'lhs':'csp','equation':'sqrt(gam*rrr*tem)'},
	                                     '7' : {'lhs':'duu','equation':'(rhs_rhu-uuu*rhs_rho)/rho'},
	                                     '8' : {'lhs':'dvv','equation':'(rhs_rhv-vvv*rhs_rho)/rho'},
	                                     '9' : {'lhs':'dww','equation':'(rhs_rhw-www*rhs_rho)/rho'},
	                                     '10' : {'lhs':'dee','equation':'(rhs_rhe-eee*rhs_rho)/rho'},
	                                     '11' : {'lhs':'dth','equation':'1./cvr*(dee-uuu*duu-vvv*dvv-www*dww)'},
	                                     '12' : {'lhs':'dr1','equation':'duu+rrr/(rho*csp)*(rho*dth+tem*rhs_rho)'},
	                                     '13' : {'lhs':'duu','equation':'dr1*0.5'},
	                                     '14' : {'lhs':'rhs_rho','equation':'(rho*csp/rrr*duu-rho*dth)/tem'},
	                                     '15' : {'lhs':'rhs_rhu','equation':'uuu*rhs_rho+rho*duu'},
	                                     '16' : {'lhs':'rhs_rhv','equation':'vvv*rhs_rho+rho*dvv'},
	                                     '17' : {'lhs':'rhs_rhw','equation':'www*rhs_rho+rho*dww'},
	                                     '18' : {'lhs':'dee','equation':'cvr*dth+(uuu*duu+vvv*dvv+www*dww)'},
	                                     '19' : {'lhs':'rhs_rhe','equation':'eee*rhs_rho+rho*dee'},
                                           },
                                    },
			    'var' : {
			             'n': 1 ,
                                     '1' : {
			                     'type' : 'manual',
			             	     'node' : 'ghost',
                                             'n' : 6,
	                                     '1' : {'lhs':'rho','equation':'#[edx]{rho}'},
	                                     '2' : {'lhs':'rhe','equation':'#[edx]{rhe}'},
	                                     '3' : {'lhs':'rhu','equation':'#[edx]{rhu}'},
	                                     '4' : {'lhs':'rhv','equation':'#[edx]{rhv}'},
	                                     '5' : {'lhs':'rhw','equation':'#[edx]{rhw}'},
	                                     '6' : {'lhs':'rya','equation':'#[edx]{rya}'},
                                           },
                                    },
	                  } , 
	     '2-start'  : {
			    'rhs' : {
			             'n': 0 ,
                                    },
			    'var' : {
			             'n': 1 ,
                                     '1' : {
			                    'type' : 'manual',
			             	    'node' : 'ghost',
                                            'n' : 5,
	                                    '1' : {'lhs':'rho','equation':'#[ply]{rho}'},
	                                    '2' : {'lhs':'rhu','equation':'#[ply]{rhu}'},
	                                    '3' : {'lhs':'rhv','equation':'#[ply]{rhv}'},
	                                    '4' : {'lhs':'rhw','equation':'#[ply]{rhw}'},
	                                    '5' : {'lhs':'rhe','equation':'#[ply]{rhe}'},
                                           },
                                    },
	                  } , 
	     '2-end'    : {
                            'rhs' : {
                                      'n':0
                                    },
			    'var' : {
			             'n': 1 ,
                                     '1' : {
			                    'type' : 'manual',
			             	    'node' : 'ghost',
                                            'n' : 5,
	                                    '1' : {'lhs':'rho','equation':'#[pry]{rho}'},
	                                    '2' : {'lhs':'rhu','equation':'#[pry]{rhu}'},
	                                    '3' : {'lhs':'rhv','equation':'#[pry]{rhv}'},
	                                    '4' : {'lhs':'rhw','equation':'#[pry]{rhw}'},
	                                    '5' : {'lhs':'rhe','equation':'#[pry]{rhe}'},
                                           },
                                    },
	                  } , 
	     '3-start'  : {
			    'rhs' : {
			             'n': 0 ,
                                    },
			    'var' : {
			             'n': 1 ,
                                     '1' : {
			                    'type' : 'manual',
			             	    'node' : 'ghost',
                                            'n' : 5,
	                                    '1' : {'lhs':'rho','equation':'#[plz]{rho}'},
	                                    '2' : {'lhs':'rhu','equation':'#[plz]{rhu}'},
	                                    '3' : {'lhs':'rhv','equation':'#[plz]{rhv}'},
	                                    '4' : {'lhs':'rhw','equation':'#[plz]{rhw}'},
	                                    '5' : {'lhs':'rhe','equation':'#[plz]{rhe}'},
                                           },
                                    },
	                  } , 
	     '3-end'    : {
                            'rhs' : {
                                      'n':0
                                    },
			    'var' : {
			             'n': 1 ,
                                     '1' : {
			                    'type' : 'manual',
			             	    'node' : 'ghost',
                                            'n' : 5,
	                                    '1' : {'lhs':'rho','equation':'#[prz]{rho}'},
	                                    '2' : {'lhs':'rhu','equation':'#[prz]{rhu}'},
	                                    '3' : {'lhs':'rhv','equation':'#[prz]{rhv}'},
	                                    '4' : {'lhs':'rhw','equation':'#[prz]{rhw}'},
	                                    '5' : {'lhs':'rhe','equation':'#[prz]{rhe}'},
                                           },
                                    },
	                  } , 
                   }
	exchange_data = { 
	     'space_var'        : 'x',
	     'point_index_send' : 25,
	     'var_send'         : 'no',
	     'rhs_send'         : 'no',
	     'n_var_recv'       : 5,
	     'n_rhs_recv'       : 5
	                  }

# -----------------------------------------------------------------------
# POST-PROCESSING
# -----------------------------------------------------------------------
post_proc = "yes"

#post_proc_kind = 'avg_xyz'
#post_proc_kind = 'avg_yz'
#post_proc_kind = 'avg_yz_flame'

#post_proc = "yes"
post_proc_kind = "post_basic"

if test_dim == '3d_triperiodic':
	post_proc_kind = 'avg_xyz'
if test_dim == '3d_inlet_outlet_biperiodic':
	post_proc_kind = 'avg_yz'
if test_dim == '3d_deflagration_wave':
	post_proc_kind = 'avg_yz_flame'

if post_proc_kind == 'post_basic':
	N_add_var = 0
	post_add_variables = {
	                 'n': N_add_var,
	                }
	post_sca_variables = {
	                }
	N_pos_var = 0
	N_tot_var = 0  
	tot_variables = { # variables are automatically defined also as tot
	                 'n': N_tot_var,
	                }
	pos_variables = {
	                'n' : N_pos_var,
 	          }
	
	average_dir = mpi_periodic
#	average_dir = {'1':'yes','2':'yes','3':'yes'}
	post_mpi_first = { 
	                    'n': 0,
	                 }
	post_mpi_second = { 
	                    'n': 0,
	                  }
	reduce_mpi_first = { 
	                    'n': 0,
	                   }
	reduce_mpi_second = { 
	                    'n': 0,
	                    }
	post_full_first = { 
	                    'n': 0,
	                  }
	post_full_second = { 
	                    'n': 0,
	                   }
	reduce_full_first = { 
	                    'n': 0,
	                    }
	reduce_full_second = { 
	                    'n': 0,
	                     }

if post_proc_kind == 'avg_xyz':
	N_add_var = 4
	post_add_variables = {
	                 'n': N_add_var,
	                 '1': {'symbol':'vox','name':'vorticity x'},
	                 '2': {'symbol':'voy','name':'vorticity y'},
	                 '3': {'symbol':'voz','name':'vorticity z'},
	                 '4': {'symbol':'eps','name':'field dissipation'},
	                }
	post_sca_variables = {
	                }
	N_tot_var = 0  
	tot_variables = { # variables are automatically defined also as tot
	                 'n': N_tot_var,
	                 '1': {'symbol':'vox','name':'vorticity x'},
	                 '2': {'symbol':'voy','name':'vorticity y'},
	                 '3': {'symbol':'voz','name':'vorticity z'},
	                 '4': {'symbol':'eps','name':'field dissipation'},
	                }
	N_pos_var = 6  
	pos_variables = {
	                'n' : N_pos_var,
	                '1' : {'symbol':'ene','average_type':'space_and_time','name':'energy'} ,
	                '2' : {'symbol':'ens','average_type':'space_and_time','name':'enstrophy'} ,
	                '3' : {'symbol':'epm','average_type':'space_and_time','name':'dissipation'} ,
	                '4' : {'symbol':'enr','average_type':'space','name':'energy space avg'} ,
	                '5' : {'symbol':'esr','average_type':'space','name':'enstrophy space avg'} ,
	                '6' : {'symbol':'epr','average_type':'space','name':'dissipation space avg'} ,
	          }
	
	#average_dir = mpi_periodic  # reasonable choice
	average_dir = {'1':'yes','2':'yes','3':'yes'}
	post_mpi_first = { 
	                    'n': 0,
	                 }
	post_mpi_second = { 
	                    'n': 10,
	                    '1':{'lhs':'vox','equation':'#[ddy]{rhw/rho}-#[ddz]{rhv/rho}' },
	                    '2':{'lhs':'voy','equation':'#[ddz]{rhu/rho}-#[ddx]{rhw/rho}' },
	                    '3':{'lhs':'voz','equation':'#[ddx]{rhv/rho}-#[ddy]{rhu/rho}' },
	                    '4':{'lhs':'eps','equation':'(#[ddx]{rhu/rho})**2+ \
                                                         (#[ddy]{rhv/rho})**2+ \
                                                         (#[ddz]{rhw/rho})**2+ \
                                                          1./2.*(#[ddy]{rhu/rho}+#[ddx]{rhv/rho})**2+ \
                                                          1./2.*(#[ddz]{rhu/rho}+#[ddx]{rhw/rho})**2+ \
                                                          1./2.*(#[ddz]{rhv/rho}+#[ddy]{rhw/rho})**2'},
	                    '5':{'lhs':'ene','equation':'ene+0.5*((rhu/rho)**2+(rhv/rho)**2+(rhw/rho)**2)*rho' },
	                    '6':{'lhs':'ens','equation':'ens+(vox**2+voy**2+voz**2)' },
	                    '7':{'lhs':'epm','equation':'epm + 2.*eps' },
	                    '8':{'lhs':'enr','equation':'enr+0.5*((rhu/rho)**2+(rhv/rho)**2+(rhw/rho)**2)*rho' },
	                    '9':{'lhs':'esr','equation':'esr+(vox**2+voy**2+voz**2)' },
	                   '10':{'lhs':'epr','equation':'epr+2.*eps' },
	                  }
	reduce_mpi_first = { 
	                    'n': 0,
	                   }
	reduce_mpi_second = { 
	                    'n': 6,
	                    '1':'ene',
	                    '2':'ens',
	                    '3':'epm',
	                    '4':'enr',
	                    '5':'esr',
	                    '6':'epr',
	                    }
	post_full_first = { 
	                    'n': 0,
	                    '1':{'lhs':'vox','equation':'#[ddy]{rhw/rho}-#[ddz]{rhv/rho}' },
	                    '2':{'lhs':'voy','equation':'#[ddz]{rhu/rho}-#[ddx]{rhw/rho}' },
	                    '3':{'lhs':'voz','equation':'#[ddx]{rhv/rho}-#[ddy]{rhu/rho}' },
	                    '4':{'lhs':'eps','equation':'(#[ddx]{rhu/rho})**2+ \
                                                         (#[ddy]{rhv/rho})**2+ \
                                                         (#[ddz]{rhw/rho})**2+ \
                                                          1./2.*(#[ddy]{rhu/rho}+#[ddx]{rhv/rho})**2+ \
                                                          1./2.*(#[ddz]{rhu/rho}+#[ddx]{rhw/rho})**2+ \
                                                          1./2.*(#[ddz]{rhv/rho}+#[ddy]{rhw/rho})**2'},
	                    '5':{'lhs':'ene','equation':'ene+0.5*((rhu/rho)**2+(rhv/rho)**2+(rhw/rho)**2)*rho' },
	                    '6':{'lhs':'ens','equation':'ens+(vox**2+voy**2+voz**2)' },
	                    '7':{'lhs':'epm','equation':'epm + 2.*eps' },
	                  }
	post_full_second = { 
	                    'n': 0,
	                   }
	reduce_full_first = { 
	                    'n': 0,
	                    '1':'ene',
	                    '2':'ens',
	                    '3':'epm',
	                    }
	reduce_full_second = { 
	                    'n': 0,
	                     }

if post_proc_kind == 'avg_yz':
        N_add_var = 7
        post_add_variables = {
                         'n': N_add_var,
                         '1': {'symbol':'uuu','name':'velocity favre fluctuation x'},
                         '2': {'symbol':'vvv','name':'velocity favre fluctuation y'},
                         '3': {'symbol':'www','name':'velocity favre fluctuation z'},
                         '4': {'symbol':'vox','name':'vorticity fluctuation favre x'},
                         '5': {'symbol':'voy','name':'vorticity fluctuation favre y'},
                         '6': {'symbol':'voz','name':'vorticity fluctuation favre z'},
                         '7': {'symbol':'eps','name':'field fluctuation favre dissipation'},
                        }
        post_sca_variables = {
                        }
        N_tot_var = 0
        tot_variables = { # variables are automatically defined also as tot
                         'n': N_tot_var,
                         '1': {'symbol':'uuu','name':'velocity favre fluctuation x'},
                         '2': {'symbol':'vvv','name':'velocity favre fluctuation y'},
                         '3': {'symbol':'www','name':'velocity favre fluctuation z'},
                         '4': {'symbol':'vox','name':'vorticity fluctuation favre x'},
                         '5': {'symbol':'voy','name':'vorticity fluctuation favre y'},
                         '6': {'symbol':'voz','name':'vorticity fluctuation favre z'},
                         '7': {'symbol':'eps','name':'field fluctuation favre dissipation'},
                        }
        N_pos_var = 13
        pos_variables = {
                        'n' : N_pos_var,
                        '1' : {'symbol':'mrh', 'average_type':'space_and_time','name':'rho average'} ,
                        '2' : {'symbol':'mru', 'average_type':'space_and_time','name':'rhu average'} ,
                        '3' : {'symbol':'mrv', 'average_type':'space_and_time','name':'rhv average'} ,
                        '4' : {'symbol':'mrw', 'average_type':'space_and_time','name':'rhw average'} ,
                        '5' : {'symbol':'mre', 'average_type':'space_and_time','name':'rhe average'} ,
                        '6' : {'symbol':'uqq', 'average_type':'space_and_time','name':'u-vel rms'} ,
                        '7' : {'symbol':'vqq', 'average_type':'space_and_time','name':'v-vel rms'} ,
                        '8' : {'symbol':'wqq', 'average_type':'space_and_time','name':'w-vel rms'} ,
                        '9' : {'symbol':'uvq', 'average_type':'space_and_time','name':'u*v average'} ,
                        '10' : {'symbol':'ene','average_type':'space_and_time','name':'energy'} ,
                        '11' : {'symbol':'ens','average_type':'space_and_time','name':'enstrophy'} ,
                        '12' : {'symbol':'epm','average_type':'space_and_time','name':'dissipation'} ,
                        '13' : {'symbol':'sci','average_type':'space_and_time','name':'integral scale'} ,
                  }

        #average_dir = mpi_periodic  # reasonable choice
        average_dir = {'1':'no','2':'yes','3':'yes'}
        post_mpi_first = {
                            'n': 5,
                            '1' :{'lhs':'mrh','equation':'mrh+rho' },
                            '2' :{'lhs':'mru','equation':'mru+rhu' },
                            '3' :{'lhs':'mrv','equation':'mrv+rhv' },
                            '4' :{'lhs':'mrw','equation':'mrw+rhw' },
                            '5' :{'lhs':'mre','equation':'mre+rhe' },
                         }
        post_mpi_second = {
                            'n': 14,
                            '1' :{'lhs':'uuu','equation':'rhu/rho-mru/mrh' },
                            '2' :{'lhs':'vvv','equation':'rhv/rho-mrv/mrh' },
                            '3' :{'lhs':'www','equation':'rhw/rho-mrw/mrh' },
                            '4' :{'lhs':'uqq','equation':'uqq+uuu**2' },
                            '5' :{'lhs':'vqq','equation':'vqq+vvv**2' },
                            '6' :{'lhs':'wqq','equation':'wqq+www**2' },
                            '7' :{'lhs':'uvq','equation':'uvq+uuu*vvv' },
                            '8' :{'lhs':'vox','equation':'#[ddy]{www}-#[ddz]{vvv}' },
                            '9' :{'lhs':'voy','equation':'#[ddz]{uuu}-#[ddx]{www}' },
                            '10':{'lhs':'voz','equation':'#[ddx]{vvv}-#[ddy]{uuu}' },
                            '11':{'lhs':'eps','equation':'(#[ddx]{uuu})**2+  \
                                                          (#[ddy]{vvv})**2+  \
                                                          (#[ddz]{www})**2+ \
                                                    1./2.*(#[ddy]{uuu}+#[ddx]{vvv})**2+ \
                                                    1./2.*(#[ddz]{uuu}+#[ddx]{www})**2+ \
                                                    1./2.*(#[ddz]{vvv}+#[ddy]{www})**2'},
                            '12' :{'lhs':'ene','equation':'ene+0.5*(uuu**2+vvv**2+www**2)*rho' },
                            '13' :{'lhs':'ens','equation':'ens+(vox**2+voy**2+voz**2)' },
                            '14' :{'lhs':'epm','equation':'epm + 2.*eps' },
                          }
        reduce_mpi_first = {
                            'n': 5,
                            '1':'mrh',
                            '2':'mru',
                            '3':'mrv',
                            '4':'mrw',
                            '5':'mre',
                           }
        reduce_mpi_second = {
                            'n': 7,
                            '1':'uqq',
                            '2':'vqq',
                            '3':'wqq',
                            '4':'uvq',
                            '5':'ene',
                            '6':'ens',
                            '7':'epm',
                            }
        post_full_first = {
                            'n': 0,
                            '1' :{'lhs':'mrh','equation':'mrh+rho' },
                            '2' :{'lhs':'mru','equation':'mru+rhu' },
                            '3' :{'lhs':'mrv','equation':'mrv+rhv' },
                            '4' :{'lhs':'mrw','equation':'mrw+rhw' },
                            '5' :{'lhs':'mre','equation':'mre+rhe' },
                          }
        post_full_second = {
                            'n': 0,
                            '1' :{'lhs':'uuu','equation':'rhu/rho-mru/mrh' },
                            '2' :{'lhs':'vvv','equation':'rhv/rho-mrv/mrh' },
                            '3' :{'lhs':'www','equation':'rhw/rho-mrw/mrh' },
                            '4' :{'lhs':'uqq','equation':'uqq+uuu**2' },
                            '5' :{'lhs':'vqq','equation':'vqq+vvv**2' },
                            '6' :{'lhs':'wqq','equation':'wqq+www**2' },
                            '7' :{'lhs':'uvq','equation':'uvq+uuu*vvv' },
                            '8' :{'lhs':'vox','equation':'#[ddy]{www}-#[ddz]{vvv}' },
                            '9' :{'lhs':'voy','equation':'#[ddz]{uuu}-#[ddx]{www}' },
                            '10':{'lhs':'voz','equation':'#[ddx]{vvv}-#[ddy]{uuu}' },
                            '11':{'lhs':'eps','equation':'(#[ddx]{uuu})**2+ \
                                                          (#[ddy]{vvv})**2+ \
                                                          (#[ddz]{www})**2+ \
                                                       1./2.*(#[ddy]{uuu}+#[ddx]{vvv})**2+ \
                                                       1./2.*(#[ddz]{uuu}+#[ddx]{www})**2+ \
                                                       1./2.*(#[ddz]{vvv}+#[ddy]{www})**2'},
                            '12' :{'lhs':'ene','equation':'ene+0.5*(uuu**2+vvv**2+www**2)*rho' },
                            '13' :{'lhs':'ens','equation':'ens+(vox**2+voy**2+voz**2)' },
                            '14' :{'lhs':'epm','equation':'epm + 2.*eps' },
                           }
        reduce_full_first = {
                            'n': 0,
                            '1':'mrh',
                            '2':'mru',
                            '3':'mrv',
                            '4':'mrw',
                            '5':'mre',
                            }
        reduce_full_second = {
                            'n': 0,
                            '1':'uqq',
                            '2':'vqq',
                            '3':'wqq',
                            '4':'uvq',
                            '5':'ene',
                            '6':'ens',
                            '7':'epm',
                             }


if post_proc_kind == 'avg_yz_flame':
	N_add_var = 7
	post_add_variables = {
	                 'n': N_add_var,
	                 '1': {'symbol':'uuu','name':'velocity favre fluctuation x'},
	                 '2': {'symbol':'vvv','name':'velocity favre fluctuation y'},
	                 '3': {'symbol':'www','name':'velocity favre fluctuation z'},
	                 '4': {'symbol':'vox','name':'vorticity fluctuation favre x'},
	                 '5': {'symbol':'voy','name':'vorticity fluctuation favre y'},
	                 '6': {'symbol':'voz','name':'vorticity fluctuation favre z'},
                         '7': {'symbol':'eps','name':'field fluctuation favre dissipation'},
	                }
	post_sca_variables = {
	                }
	N_tot_var = 0  
	tot_variables = { # variables are automatically defined also as tot
	                 'n': N_tot_var,
	                 '1': {'symbol':'uuu','name':'velocity favre fluctuation x'},
	                 '2': {'symbol':'vvv','name':'velocity favre fluctuation y'},
	                 '3': {'symbol':'www','name':'velocity favre fluctuation z'},
	                 '4': {'symbol':'vox','name':'vorticity fluctuation favre x'},
	                 '5': {'symbol':'voy','name':'vorticity fluctuation favre y'},
	                 '6': {'symbol':'voz','name':'vorticity fluctuation favre z'},
                         '7': {'symbol':'eps','name':'field fluctuation favre dissipation'},
	                }
	N_pos_var = 14
	pos_variables = {
	                'n' : N_pos_var,
	                '1' : {'symbol':'mrh', 'average_type':'space','name':'rho average'} ,
	                '2' : {'symbol':'mru', 'average_type':'space','name':'rhu average'} ,
	                '3' : {'symbol':'mrv', 'average_type':'space','name':'rhv average'} ,
	                '4' : {'symbol':'mrw', 'average_type':'space','name':'rhw average'} ,
	                '5' : {'symbol':'mre', 'average_type':'space','name':'rhe average'} ,
	                '6' : {'symbol':'uqq', 'average_type':'space','name':'u-vel rms'} ,
	                '7' : {'symbol':'vqq', 'average_type':'space','name':'v-vel rms'} ,
	                '8' : {'symbol':'wqq', 'average_type':'space','name':'w-vel rms'} ,
	                '9' : {'symbol':'uvq', 'average_type':'space','name':'u*v average'} ,
	                '10' : {'symbol':'ene','average_type':'space','name':'energy'} ,
	                '11' : {'symbol':'ens','average_type':'space','name':'enstrophy'} ,
	                '12' : {'symbol':'epm','average_type':'space','name':'dissipation'} ,
	                '13' : {'symbol':'sci','average_type':'space','name':'integral scale'} ,
	                '14' : {'symbol':'mry','average_type':'space','name':'rya average'} ,
	          }
	
	#average_dir = mpi_periodic  # reasonable choice
	average_dir = {'1':'no','2':'yes','3':'yes'}
	post_mpi_first = { 
	                    'n': 0,
	                    '1' :{'lhs':'mrh','equation':'mrh+rho' },
	                    '2' :{'lhs':'mru','equation':'mru+rhu' },
	                    '3' :{'lhs':'mrv','equation':'mrv+rhv' },
	                    '4' :{'lhs':'mrw','equation':'mrw+rhw' },
	                    '5' :{'lhs':'mre','equation':'mre+rhe' },
	                    '6' :{'lhs':'mry','equation':'mry+rya' },
	                 }
	post_mpi_second = { 
	                    'n': 20,
	                    '1' :{'lhs':'uuu','equation':'rhu/rho-mru/mrh' },
	                    '2' :{'lhs':'vvv','equation':'rhv/rho-mrv/mrh' },
	                    '3' :{'lhs':'www','equation':'rhw/rho-mrw/mrh' },
	                    '4' :{'lhs':'uqq','equation':'uqq+uuu**2' },
	                    '5' :{'lhs':'vqq','equation':'vqq+vvv**2' },
	                    '6' :{'lhs':'wqq','equation':'wqq+www**2' },
	                    '7' :{'lhs':'uvq','equation':'uvq+uuu*vvv' },
	                    '8' :{'lhs':'vox','equation':'#[ddy]{www}-#[ddz]{vvv}' },
	                    '9' :{'lhs':'voy','equation':'#[ddz]{uuu}-#[ddx]{www}' },
	                    '10':{'lhs':'voz','equation':'#[ddx]{vvv}-#[ddy]{uuu}' },
	                    '11':{'lhs':'eps','equation':'(#[ddx]{uuu})**2+  \
                                                          (#[ddy]{vvv})**2+  \
                                                          (#[ddz]{www})**2+ \
                                                    1./2.*(#[ddy]{uuu}+#[ddx]{vvv})**2+ \
                                                    1./2.*(#[ddz]{uuu}+#[ddx]{www})**2+ \
                                                    1./2.*(#[ddz]{vvv}+#[ddy]{www})**2'},
	                    '12' :{'lhs':'ene','equation':'ene+0.5*(uuu**2+vvv**2+www**2)*rho' },
	                    '13' :{'lhs':'ens','equation':'ens+(vox**2+voy**2+voz**2)' },
	                    '14' :{'lhs':'epm','equation':'epm + 2.*eps' },
	                    '15' :{'lhs':'mrh','equation':'mrh+rho' },
	                    '16' :{'lhs':'mru','equation':'mru+rhu' },
	                    '17' :{'lhs':'mrv','equation':'mrv+rhv' },
	                    '18' :{'lhs':'mrw','equation':'mrw+rhw' },
	                    '19' :{'lhs':'mre','equation':'mre+rhe' },
	                    '20' :{'lhs':'mry','equation':'mry+rya' },
	                  }
	reduce_mpi_first = { 
	                    'n': 0,
	                    '1':'mrh',
	                    '2':'mru',
	                    '3':'mrv',
	                    '4':'mrw',
	                    '5':'mre',
	                    '6':'mry',
	                   }
	reduce_mpi_second = { 
	                    'n': 13,
	                    '1':'uqq',
	                    '2':'vqq',
	                    '3':'wqq',
	                    '4':'uvq',
	                    '5':'ene',
	                    '6':'ens',
	                    '7':'epm',
	                    '8':'mrh',
	                    '9':'mru',
	                    '10':'mrv',
	                    '11':'mrw',
	                    '12':'mre',
	                    '13':'mry',
	                    }
	post_full_first = { 
	                    'n': 0,
	                    '1' :{'lhs':'mrh','equation':'mrh+rho' },
	                    '2' :{'lhs':'mru','equation':'mru+rhu' },
	                    '3' :{'lhs':'mrv','equation':'mrv+rhv' },
	                    '4' :{'lhs':'mrw','equation':'mrw+rhw' },
	                    '5' :{'lhs':'mre','equation':'mre+rhe' },
	                  }
	post_full_second = { 
	                    'n': 0,
	                    '1' :{'lhs':'uuu','equation':'rhu/rho-mru/mrh' },
	                    '2' :{'lhs':'vvv','equation':'rhv/rho-mrv/mrh' },
	                    '3' :{'lhs':'www','equation':'rhw/rho-mrw/mrh' },
	                    '4' :{'lhs':'uqq','equation':'uqq+uuu**2' },
	                    '5' :{'lhs':'vqq','equation':'vqq+vvv**2' },
	                    '6' :{'lhs':'wqq','equation':'wqq+www**2' },
	                    '7' :{'lhs':'uvq','equation':'uvq+uuu*vvv' },
	                    '8' :{'lhs':'vox','equation':'#[ddy]{www}-#[ddz]{vvv}' },
	                    '9' :{'lhs':'voy','equation':'#[ddz]{uuu}-#[ddx]{www}' },
	                    '10':{'lhs':'voz','equation':'#[ddx]{vvv}-#[ddy]{uuu}' },
	                    '11':{'lhs':'eps','equation':'(#[ddx]{uuu})**2+ \
                                                          (#[ddy]{vvv})**2+ \
                                                          (#[ddz]{www})**2+ \
                                                       1./2.*(#[ddy]{uuu}+#[ddx]{vvv})**2+ \
                                                       1./2.*(#[ddz]{uuu}+#[ddx]{www})**2+ \
                                                       1./2.*(#[ddz]{vvv}+#[ddy]{www})**2'},
	                    '12' :{'lhs':'ene','equation':'ene+0.5*(uuu**2+vvv**2+www**2)*rho' },
	                    '13' :{'lhs':'ens','equation':'ens+(vox**2+voy**2+voz**2)' },
	                    '14' :{'lhs':'epm','equation':'epm + 2.*eps' },
	                   }
	reduce_full_first = { 
	                    'n': 0,
	                    '1':'mrh',
	                    '2':'mru',
	                    '3':'mrv',
	                    '4':'mrw',
	                    '5':'mre',
	                    }
	reduce_full_second = { 
	                    'n': 0,
	                    '1':'uqq',
	                    '2':'vqq',
	                    '3':'wqq',
	                    '4':'uvq',
	                    '5':'ene',
	                    '6':'ens',
	                    '7':'epm',
	                     }

# compact operators are not implemented in the current version
compact_operators = {
     "cd":    { 
                "generic":"yes",
                "prefactor-uniform":"der1d",
                "prefactor":"v_",
		"A" : {
                         'nbelowmax':1,
                         'nabovemax':'2',
                      },
		"B" : {
                         'nbelowmax':1,
                         'nabovemax':'2',
                      },
		"center" : 
		   {
			"A": {
                                'nbelow':1,
                                'nabove':'1',
                                'coeff':{"-1":"-1","0":"1.","1":"2."}
                             },
			"B": {
                                'nbelow':0,
                                'nabove':'1',
                                'coeff':{"0":"1.","1":"1."}
                             }
		   },
		"bc_1": 
                   {
			"n" : 2,
			"1" : {
			        "A": {
                                        'nbelow':'0',
                                        'nabove':'2',
                                        'coeff':{"0":"1.","1":"2.","2":"3"}
                                     },
			        "B": {
                                        'nbelow':'0',
                                        'nabove':'2',
                                        'coeff':{"0":"1.","1":"2.","2":"3"}
                                     }
			      },
			"2" : {
			        "A": {
                                        'nbelow':'1',
                                        'nabove':'1',
                                        'coeff':{"-1":"-1","0":"1.","1":"2."}
                                     },
			        "B": {
                                        'nbelow':0,
                                        'nabove':'1',
                                        'coeff':{"0":"1.","1":"1."}
                                     }
			      },
                   },
		"bc_2": 
                   {
			"n" : 2,
			"-1" : {
			        "A": {
                                        'nbelow':1,
                                        'nabove':1,
                                        'coeff':{"-1":"-1.","0":"1.","1":"2"}
                                     },
			        "B": {
                                        'nbelow':1,
                                        'nabove':0,
                                        'coeff':{"-1":"2","0":"1."}
                                     }
			      },
			"0" : {
			        "A": {
                                        'nbelow':1,
                                        'nabove':0,
                                        'coeff':{"0":"1.","-1":"-1."}
                                     },
			        "B": {
                                        'nbelow':1,
                                        'nabove':0,
                                        'coeff':{"0":"1.","-1":"1."}
                                     }
			      }
                  }
              },
     "cb":    { 
                "generic":"yes",
                "prefactor-uniform":"der1d",
                "prefactor":"s_",
		"A" : {
                         'nbelowmax':1,
                         'nabovemax':'1',
                      },
		"B" : {
                         'nbelowmax':2,
                         'nabovemax':'2',
                      },
		"center" : 
		   {
			"A": {
                                'nbelow':1,
                                'nabove':'1',
                                'coeff':{"-1":"1./3.","0":"1.","1":"1./3."}
                             },
			"B": {
                                'nbelow':2,
                                'nabove':'2',
                                'coeff':{"-2":"-1./36.","-1":"-7./9.","0":"0.","1":"7./9.","2":"1./36."}
                             }
		   },
		"bc_1": 
                   {
			"n" : 2,
			"1" : {
			        "A": {
                                        'nbelow':'0',
                                        'nabove':'1',
                                        'coeff':{"0":"1.","1":"1."}
                                     },
			        "B": {
                                        'nbelow':'0',
                                        'nabove':'1',
                                        'coeff':{"0":"-2.","1":"2."}
                                     }
			      },
			"2" : {
			        "A": {
                                        'nbelow':'1',
                                        'nabove':'0',
                                        'coeff':{"-1":"1./2.","0":"1."}
                                     },
			        "B": {
                                        'nbelow':'1',
                                        'nabove':'1',
                                        'coeff':{"-1":"-5./4.","0":"1.","1":"1./4."}
                                     }
			      },
                   },
		"bc_2": 
                   {
			"n" : 2,
			"-1" : {
			        "A": {
                                        'nbelow':1,
                                        'nabove':0,
                                        'coeff':{"-1":"1.","0":"1."}
                                     },
			        "B": {
                                        'nbelow':1,
                                        'nabove':0,
                                        'coeff':{"-1":"-2","0":"2."}
                                     }
			      },
			"0" : {
			        "A": {
                                        'nbelow':1,
                                        'nabove':0,
                                        'coeff':{"-1":"1.","0":"1."}
                                     },
			        "B": {
                                        'nbelow':1,
                                        'nabove':0,
                                        'coeff':{"-1":"-2","0":"2."}
                                     }
			      }
                  }
              },
     "ct":    { 
                "generic":"yes", "prefactor-uniform":"der2d", "prefactor":"s_",
		"A" : { 'nbelowmax':0, 'nabovemax':'0', },
		"B" : { 'nbelowmax':2, 'nabovemax':'2', },
		"center" : 
		   {
			"A": { 'nbelow':'0', 'nabove':'0', 'coeff':{"0":"1."} },
			"B": { 'nbelow':'1', 'nabove':'1', 'coeff':{"-1":"1.","0":"-2.","1":"1."} }
		   },
		"bc_1": 
                   {
			"n" : 1,
			"1" : {
			        "A": { 'nbelow':'0', 'nabove':'0', 'coeff':{"0":"1."} },
			        "B": { 'nbelow':'0', 'nabove':'2', 'coeff':{"0":"1.","1":"-2.","2":"1."} }
			      },
                   },
		"bc_2": 
                   {
			"n" : 1,
			"0" : {
			        "A": { 'nbelow':0, 'nabove':0, 'coeff':{"0":"1."} },
			        "B": { 'nbelow':2, 'nabove':0, 'coeff':{"-2":"1","-1":"-2.","0":"1."} }
			      }
                  }
              }
            }

operators = {
#    centered first derivative
     "dd":    { 
                "generic":"yes",
                "prefactor-uniform":"der1d",
                "prefactor":"",
              #  "coeff": {"+1":"+1./2.","-1":"-1./2."}
                "coeff": {"-2":"+1./12.","-1":"-2./3.","+1":"+2./3.","+2":"-1./12."}
              },
#    centered second derivative
     "ds":    { 
                "generic":"yes",
                "prefactor-uniform":"der2d",
                "prefactor":"",
               # "coeff": {"+1":"+1.","+0":"-2.","-1":"+1."}
                "coeff": {"-2":"-1./12.","-1":"+4./3.","+0":"-5./2.","+1":"+4./3.","+2":"-1./12."}
              },
#    linear extrapolation towards right 
     "ex":    { 
                "generic":"yes",
                "prefactor-uniform":"der0d",
                "prefactor":"1.",
                "coeff": {"-1":"2.","-2":"-1."}
              },
#    linear extrapolation towards left
     "es":    { 
                "generic":"yes",
                "prefactor-uniform":"der0d",
                "prefactor":"1.",
                "coeff": {"+1":"2.","+2":"-1."}
              },
#    constant extrapolation towards right, just a translation
     "ed":    { 
                "generic":"yes",
                "prefactor-uniform":"der0d",
                "prefactor":"",
                "coeff": {"-1":"+1."}
              },
#    constant extrapolation towards left, just a translation
     "ec":    { 
                "generic":"yes",
                "prefactor-uniform":"der0d",
                "prefactor":"",
                "coeff": {"+1":"+1."}
              },
#    periodic conditions on the left: MPI does the real job
     "pl":    { 
                "generic":"yes",
                "prefactor-uniform":"der0d",
                "prefactor":"1.",
                "coeff": {"+n":"+1."}
              },
#    periodic conditions on the right: MPI does the real job
     "pr":    { 
                "generic":"yes",
                "prefactor-uniform":"der0d",
                "prefactor":"1.",
                "coeff": {"-n":"+1."}
              },
            }

compact_operators = {}

